home *** CD-ROM | disk | FTP | other *** search
MacBinary | 2000-02-25 | 27.8 KB | [TEXT/CWIE] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| Compact Compressed (Unix) (archive/compact)
| ext
| Supported |
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary II, Fri Feb 25 05:00:00 2000, modified Fri Feb 25 05:00:00 2000, creator 'CWIE', type ASCII, 27804 bytes "WELowLevelEditing.c" , at 0x6d1c 286 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [CWIE] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 13 57 45 4c 6f 77 4c | 65 76 65 6c 45 64 69 74 |..WELowL|evelEdit|
|00000010| 69 6e 67 2e 63 00 00 00 | 00 00 00 00 00 00 00 00 |ing.c...|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 00 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 6c 9c 00 | 00 01 1e b4 dc 03 20 b4 |.....l..|...... .|
|00000060| dc 03 20 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.. .....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 72 c1 00 00 |........|....r...|
|00000080| 2f 2a 0d 20 2a 09 57 45 | 4c 6f 77 4c 65 76 65 6c |/*. *.WE|LowLevel|
|00000090| 45 64 69 74 69 6e 67 2e | 63 0d 20 2a 0d 20 2a 09 |Editing.|c. *. *.|
|000000a0| 57 41 53 54 45 20 50 52 | 4f 4a 45 43 54 0d 20 2a |WASTE PR|OJECT. *|
|000000b0| 20 20 4c 6f 77 2d 4c 65 | 76 65 6c 20 45 64 69 74 | Low-Le|vel Edit|
|000000c0| 69 6e 67 20 52 6f 75 74 | 69 6e 65 73 0d 20 2a 0d |ing Rout|ines. *.|
|000000d0| 20 2a 20 20 43 6f 70 79 | 72 69 67 68 74 20 28 63 | * Copy|right (c|
|000000e0| 29 20 31 39 39 33 2d 31 | 39 39 38 20 4d 61 72 63 |) 1993-1|998 Marc|
|000000f0| 6f 20 50 69 6f 76 61 6e | 65 6c 6c 69 0d 20 2a 09 |o Piovan|elli. *.|
|00000100| 41 6c 6c 20 52 69 67 68 | 74 73 20 52 65 73 65 72 |All Righ|ts Reser|
|00000110| 76 65 64 0d 20 2a 0d 20 | 2a 20 20 43 20 70 6f 72 |ved. *. |* C por|
|00000120| 74 20 62 79 20 44 61 6e | 20 43 72 65 76 69 65 72 |t by Dan| Crevier|
|00000130| 0d 20 2a 0d 20 2a 2f 0d | 0d 2f 2a 0d 09 50 6f 72 |. *. */.|./*..Por|
|00000140| 74 69 6f 6e 73 20 63 6f | 70 79 72 69 67 68 74 20 |tions co|pyright |
|00000150| a9 20 31 39 39 38 2d 31 | 39 39 39 20 62 79 20 41 |. 1998-1|999 by A|
|00000160| 70 70 6c 65 20 43 6f 6d | 70 75 74 65 72 2c 20 49 |pple Com|puter, I|
|00000170| 6e 63 2e 20 41 6c 6c 20 | 72 69 67 68 74 73 20 72 |nc. All |rights r|
|00000180| 65 73 65 72 76 65 64 2e | 0d 0d 09 43 68 61 6e 67 |eserved.|...Chang|
|00000190| 65 20 48 69 73 74 6f 72 | 79 3a 0d 09 09 31 31 2f |e Histor|y:...11/|
|000001a0| 31 37 2f 39 39 09 54 57 | 42 09 09 53 74 72 65 61 |17/99.TW|B..Strea|
|000001b0| 6d 69 6e 67 20 73 75 70 | 70 6f 72 74 20 66 6f 72 |ming sup|port for|
|000001c0| 20 73 74 79 6c 65 72 73 | 2e 20 0d 09 09 31 31 2f | stylers|. ...11/|
|000001d0| 31 35 2f 39 39 09 54 57 | 42 09 09 41 64 64 20 73 |15/99.TW|B..Add s|
|000001e0| 74 79 6c 65 72 73 2e 20 | 0d 09 09 31 31 2f 31 33 |tylers. |...11/13|
|000001f0| 2f 39 39 09 54 57 42 09 | 09 43 6c 65 61 72 20 74 |/99.TWB.|.Clear t|
|00000200| 68 65 20 6f 62 6a 65 63 | 74 20 72 65 66 65 72 65 |he objec|t refere|
|00000210| 6e 63 65 20 61 66 74 65 | 72 20 66 72 65 65 69 6e |nce afte|r freein|
|00000220| 67 2e 20 0d 09 09 09 09 | 09 09 09 46 69 78 65 64 |g. .....|...Fixed|
|00000230| 20 4e 65 77 53 74 79 6c | 65 20 74 6f 20 72 65 6d | NewStyl|e to rem|
|00000240| 65 6d 62 65 72 20 74 68 | 65 20 70 6f 73 69 74 69 |ember th|e positi|
|00000250| 6f 6e 20 6f 66 20 74 68 | 65 20 66 69 72 73 74 20 |on of th|e first |
|00000260| 75 6e 75 73 65 64 0d 09 | 09 09 09 09 09 09 65 6e |unused..|......en|
|00000270| 74 72 79 2c 20 74 6f 20 | 61 67 72 65 65 20 77 69 |try, to |agree wi|
|00000280| 74 68 20 74 68 65 20 63 | 6f 6d 6d 65 6e 74 73 2e |th the c|omments.|
|00000290| 20 0d 09 09 31 31 2f 31 | 30 2f 39 39 09 54 57 42 | ...11/1|0/99.TWB|
|000002a0| 09 09 43 6c 65 61 6e 20 | 75 70 20 74 68 65 20 70 |..Clean |up the p|
|000002b0| 72 69 76 61 74 65 20 69 | 6e 74 65 72 66 61 63 65 |rivate i|nterface|
|000002c0| 73 2e 20 0d 09 09 31 30 | 2f 32 39 2f 39 38 09 54 |s. ...10|/29/98.T|
|000002d0| 57 42 09 09 5a 6f 6f 6d | 20 73 75 70 70 6f 72 74 |WB..Zoom| support|
|000002e0| 2e 20 0d 2a 2f 0d 0d 0d | 23 69 6e 63 6c 75 64 65 |. .*/...|#include|
|000002f0| 20 22 57 41 53 54 45 49 | 6e 74 66 2e 68 22 0d 0d | "WASTEI|ntf.h"..|
|00000300| 70 61 73 63 61 6c 20 42 | 6f 6f 6c 65 61 6e 20 5f |pascal B|oolean _|
|00000310| 57 45 49 73 57 6f 72 64 | 52 61 6e 67 65 28 53 49 |WEIsWord|Range(SI|
|00000320| 6e 74 33 32 20 72 61 6e | 67 65 53 74 61 72 74 2c |nt32 ran|geStart,|
|00000330| 20 53 49 6e 74 33 32 20 | 72 61 6e 67 65 45 6e 64 | SInt32 |rangeEnd|
|00000340| 2c 20 57 45 48 61 6e 64 | 6c 65 20 68 57 45 29 0d |, WEHand|le hWE).|
|00000350| 7b 0d 09 2f 2f 20 5f 57 | 45 49 73 57 6f 72 64 52 |{..// _W|EIsWordR|
|00000360| 61 6e 67 65 20 72 65 74 | 75 72 6e 73 20 74 72 75 |ange ret|urns tru|
|00000370| 65 20 69 66 20 74 68 65 | 20 73 70 65 63 69 66 69 |e if the| specifi|
|00000380| 65 64 20 72 61 6e 67 65 | 20 69 73 20 61 20 77 6f |ed range| is a wo|
|00000390| 72 64 20 72 61 6e 67 65 | 2c 0d 09 2f 2f 20 69 2e |rd range|,..// i.|
|000003a0| 65 2e 20 69 66 20 69 74 | 20 77 6f 75 6c 64 20 62 |e. if it| would b|
|000003b0| 65 20 70 6f 73 73 69 62 | 6c 65 20 74 6f 20 73 65 |e possib|le to se|
|000003c0| 6c 65 63 74 20 69 74 20 | 62 79 20 64 6f 75 62 6c |lect it |by doubl|
|000003d0| 65 2d 63 6c 69 63 6b 69 | 6e 67 20 61 6e 64 20 28 |e-clicki|ng and (|
|000003e0| 6f 70 74 69 6f 6e 61 6c | 6c 79 29 20 64 72 61 67 |optional|ly) drag|
|000003f0| 67 69 6e 67 2e 0d 0d 09 | 53 49 6e 74 33 32 20 77 |ging....|SInt32 w|
|00000400| 6f 72 64 53 74 61 72 74 | 2c 20 77 6f 72 64 45 6e |ordStart|, wordEn|
|00000410| 64 3b 0d 0d 09 2f 2f 20 | 64 65 74 65 72 6d 69 6e |d;...// |determin|
|00000420| 65 20 69 66 20 72 61 6e | 67 65 53 74 61 72 74 20 |e if ran|geStart |
|00000430| 69 73 20 61 74 20 74 68 | 65 20 62 65 67 69 6e 6e |is at th|e beginn|
|00000440| 69 6e 67 20 6f 66 20 61 | 20 77 6f 72 64 0d 09 57 |ing of a| word..W|
|00000450| 45 46 69 6e 64 57 6f 72 | 64 28 72 61 6e 67 65 53 |EFindWor|d(rangeS|
|00000460| 74 61 72 74 2c 20 6b 4c | 65 61 64 69 6e 67 45 64 |tart, kL|eadingEd|
|00000470| 67 65 2c 20 26 77 6f 72 | 64 53 74 61 72 74 2c 20 |ge, &wor|dStart, |
|00000480| 26 77 6f 72 64 45 6e 64 | 2c 20 68 57 45 29 3b 0d |&wordEnd|, hWE);.|
|00000490| 09 69 66 20 28 72 61 6e | 67 65 53 74 61 72 74 20 |.if (ran|geStart |
|000004a0| 3d 3d 20 77 6f 72 64 53 | 74 61 72 74 29 0d 09 7b |== wordS|tart)..{|
|000004b0| 0d 0d 09 09 2f 2f 20 64 | 65 74 65 72 6d 69 6e 65 |....// d|etermine|
|000004c0| 20 69 66 20 72 61 6e 67 | 65 45 6e 64 20 69 73 20 | if rang|eEnd is |
|000004d0| 61 74 20 74 68 65 20 65 | 6e 64 20 6f 66 20 61 20 |at the e|nd of a |
|000004e0| 77 6f 72 64 0d 09 09 57 | 45 46 69 6e 64 57 6f 72 |word...W|EFindWor|
|000004f0| 64 28 72 61 6e 67 65 45 | 6e 64 2c 20 6b 54 72 61 |d(rangeE|nd, kTra|
|00000500| 69 6c 69 6e 67 45 64 67 | 65 2c 20 26 77 6f 72 64 |ilingEdg|e, &word|
|00000510| 53 74 61 72 74 2c 20 26 | 77 6f 72 64 45 6e 64 2c |Start, &|wordEnd,|
|00000520| 20 68 57 45 29 3b 0d 09 | 09 72 65 74 75 72 6e 20 | hWE);..|.return |
|00000530| 28 72 61 6e 67 65 45 6e | 64 20 3d 3d 20 77 6f 72 |(rangeEn|d == wor|
|00000540| 64 45 6e 64 29 3b 0d 09 | 7d 0d 09 72 65 74 75 72 |dEnd);..|}..retur|
|00000550| 6e 20 66 61 6c 73 65 3b | 0d 7d 0d 0d 70 61 73 63 |n false;|.}..pasc|
|00000560| 61 6c 20 42 6f 6f 6c 65 | 61 6e 20 5f 57 45 49 73 |al Boole|an _WEIs|
|00000570| 50 75 6e 63 74 28 53 49 | 6e 74 33 32 20 6f 66 66 |Punct(SI|nt32 off|
|00000580| 73 65 74 2c 20 57 45 48 | 61 6e 64 6c 65 20 68 57 |set, WEH|andle hW|
|00000590| 45 29 0d 7b 0d 09 53 49 | 6e 74 31 36 20 63 54 79 |E).{..SI|nt16 cTy|
|000005a0| 70 65 3b 0d 0d 09 63 54 | 79 70 65 20 3d 20 57 45 |pe;...cT|ype = WE|
|000005b0| 43 68 61 72 54 79 70 65 | 28 6f 66 66 73 65 74 2c |CharType|(offset,|
|000005c0| 20 68 57 45 29 3b 0d 09 | 69 66 20 28 28 63 54 79 | hWE);..|if ((cTy|
|000005d0| 70 65 20 26 20 73 6d 63 | 54 79 70 65 4d 61 73 6b |pe & smc|TypeMask|
|000005e0| 29 20 3d 3d 20 73 6d 43 | 68 61 72 50 75 6e 63 74 |) == smC|harPunct|
|000005f0| 29 0d 09 7b 0d 09 09 63 | 54 79 70 65 20 26 3d 20 |)..{...c|Type &= |
|00000600| 73 6d 63 43 6c 61 73 73 | 4d 61 73 6b 3b 0d 09 09 |smcClass|Mask;...|
|00000610| 69 66 20 28 28 63 54 79 | 70 65 20 3d 3d 20 73 6d |if ((cTy|pe == sm|
|00000620| 50 75 6e 63 74 4e 6f 72 | 6d 61 6c 29 20 7c 7c 20 |PunctNor|mal) || |
|00000630| 28 63 54 79 70 65 20 3d | 3d 20 73 6d 50 75 6e 63 |(cType =|= smPunc|
|00000640| 74 42 6c 61 6e 6b 29 29 | 0d 09 09 7b 0d 09 09 09 |tBlank))|...{....|
|00000650| 72 65 74 75 72 6e 20 74 | 72 75 65 3b 0d 09 09 7d |return t|rue;...}|
|00000660| 0d 09 7d 0d 09 72 65 74 | 75 72 6e 20 66 61 6c 73 |..}..ret|urn fals|
|00000670| 65 3b 0d 7d 0d 0d 70 61 | 73 63 61 6c 20 76 6f 69 |e;.}..pa|scal voi|
|00000680| 64 20 5f 57 45 49 6e 74 | 65 6c 6c 69 67 65 6e 74 |d _WEInt|elligent|
|00000690| 43 75 74 28 53 49 6e 74 | 33 32 20 2a 72 61 6e 67 |Cut(SInt|32 *rang|
|000006a0| 65 53 74 61 72 74 2c 20 | 53 49 6e 74 33 32 20 2a |eStart, |SInt32 *|
|000006b0| 72 61 6e 67 65 45 6e 64 | 2c 20 57 45 48 61 6e 64 |rangeEnd|, WEHand|
|000006c0| 6c 65 20 68 57 45 29 0d | 7b 0d 0d 09 2f 2f 20 5f |le hWE).|{...// _|
|000006d0| 57 45 49 6e 74 65 6c 6c | 69 67 65 6e 74 43 75 74 |WEIntell|igentCut|
|000006e0| 20 69 73 20 63 61 6c 6c | 65 64 20 62 79 20 6f 74 | is call|ed by ot|
|000006f0| 68 65 72 20 57 41 53 54 | 45 20 72 6f 75 74 69 6e |her WAST|E routin|
|00000700| 65 73 20 74 6f 20 64 65 | 74 65 72 6d 69 6e 65 20 |es to de|termine |
|00000710| 74 68 65 20 61 63 74 75 | 61 6c 0d 09 2f 2f 20 72 |the actu|al..// r|
|00000720| 61 6e 67 65 20 74 6f 20 | 62 65 20 64 65 6c 65 74 |ange to |be delet|
|00000730| 65 64 20 77 68 65 6e 20 | 77 65 46 49 6e 74 43 75 |ed when |weFIntCu|
|00000740| 74 41 6e 64 50 61 73 74 | 65 20 69 73 20 65 6e 61 |tAndPast|e is ena|
|00000750| 62 6c 65 64 2e 0d 09 2f | 2f 20 4f 6e 20 65 6e 74 |bled.../|/ On ent|
|00000760| 72 79 2c 20 72 61 6e 67 | 65 53 74 61 72 74 20 61 |ry, rang|eStart a|
|00000770| 6e 64 20 72 61 6e 67 65 | 45 6e 64 20 73 70 65 63 |nd range|End spec|
|00000780| 69 66 79 20 74 68 65 20 | 73 65 6c 65 63 74 69 6f |ify the |selectio|
|00000790| 6e 20 72 61 6e 67 65 20 | 76 69 73 69 62 6c 65 20 |n range |visible |
|000007a0| 74 6f 20 74 68 65 20 75 | 73 65 72 2e 0d 09 2f 2f |to the u|ser...//|
|000007b0| 20 4f 6e 20 65 78 69 74 | 2c 20 72 61 6e 67 65 53 | On exit|, rangeS|
|000007c0| 74 61 72 74 20 61 6e 64 | 20 72 61 6e 67 65 45 6e |tart and| rangeEn|
|000007d0| 64 20 73 70 65 63 69 66 | 79 20 74 68 65 20 61 63 |d specif|y the ac|
|000007e0| 74 75 61 6c 20 72 61 6e | 67 65 20 74 6f 20 62 65 |tual ran|ge to be|
|000007f0| 20 72 65 6d 6f 76 65 64 | 2e 0d 0d 09 2f 2f 20 64 | removed|....// d|
|00000800| 6f 20 6e 6f 74 68 69 6e | 67 20 69 66 20 74 68 65 |o nothin|g if the|
|00000810| 20 69 6e 74 65 6c 6c 69 | 67 65 6e 74 20 63 75 74 | intelli|gent cut|
|00000820| 2d 61 6e 64 2d 70 61 73 | 74 65 20 66 65 61 74 75 |-and-pas|te featu|
|00000830| 72 65 20 69 73 20 64 69 | 73 61 62 6c 65 64 0d 09 |re is di|sabled..|
|00000840| 69 66 20 28 21 42 54 53 | 54 28 28 2a 68 57 45 29 |if (!BTS|T((*hWE)|
|00000850| 2d 3e 66 65 61 74 75 72 | 65 73 2c 20 77 65 46 49 |->featur|es, weFI|
|00000860| 6e 74 43 75 74 41 6e 64 | 50 61 73 74 65 29 29 0d |ntCutAnd|Paste)).|
|00000870| 09 7b 0d 09 09 72 65 74 | 75 72 6e 3b 0d 09 7d 0d |.{...ret|urn;..}.|
|00000880| 0d 09 2f 2f 20 69 6e 74 | 65 6c 6c 69 6e 67 20 63 |..// int|elling c|
|00000890| 75 74 2d 26 2d 70 61 73 | 74 65 20 72 75 6c 65 73 |ut-&-pas|te rules|
|000008a0| 20 73 68 6f 75 6c 64 20 | 62 65 20 61 70 70 6c 69 | should |be appli|
|000008b0| 65 64 20 6f 6e 6c 79 20 | 74 6f 20 77 6f 72 64 20 |ed only |to word |
|000008c0| 72 61 6e 67 65 73 2e 2e | 2e 0d 09 69 66 20 28 21 |ranges..|...if (!|
|000008d0| 5f 57 45 49 73 57 6f 72 | 64 52 61 6e 67 65 28 2a |_WEIsWor|dRange(*|
|000008e0| 72 61 6e 67 65 53 74 61 | 72 74 2c 20 2a 72 61 6e |rangeSta|rt, *ran|
|000008f0| 67 65 45 6e 64 2c 20 68 | 57 45 29 29 0d 09 7b 0d |geEnd, h|WE))..{.|
|00000900| 09 09 72 65 74 75 72 6e | 3b 0d 09 7d 0d 0d 09 2f |..return|;..}.../|
|00000910| 2f 20 2e 2e 2e 77 69 74 | 68 6f 75 74 20 70 75 6e |/ ...wit|hout pun|
|00000920| 63 74 75 61 74 69 6f 6e | 20 63 68 61 72 61 63 74 |ctuation| charact|
|00000930| 65 72 73 20 61 74 20 74 | 68 65 20 62 65 67 69 6e |ers at t|he begin|
|00000940| 6e 69 6e 67 20 6f 72 20 | 65 6e 64 0d 09 69 66 20 |ning or |end..if |
|00000950| 28 5f 57 45 49 73 50 75 | 6e 63 74 28 2a 72 61 6e |(_WEIsPu|nct(*ran|
|00000960| 67 65 53 74 61 72 74 2c | 20 68 57 45 29 29 0d 09 |geStart,| hWE))..|
|00000970| 7b 0d 09 09 72 65 74 75 | 72 6e 3b 0d 09 7d 0d 09 |{...retu|rn;..}..|
|00000980| 69 66 20 28 5f 57 45 49 | 73 50 75 6e 63 74 28 2a |if (_WEI|sPunct(*|
|00000990| 72 61 6e 67 65 45 6e 64 | 20 2d 20 31 2c 20 68 57 |rangeEnd| - 1, hW|
|000009a0| 45 29 29 0d 09 7b 0d 09 | 09 72 65 74 75 72 6e 3b |E))..{..|.return;|
|000009b0| 0d 09 7d 0d 0d 09 2f 2f | 20 69 66 20 74 68 65 20 |..}...//| if the |
|000009c0| 63 68 61 72 61 63 74 65 | 72 20 70 72 65 63 65 64 |characte|r preced|
|000009d0| 69 6e 67 20 74 68 65 20 | 73 65 6c 65 63 74 69 6f |ing the |selectio|
|000009e0| 6e 20 72 61 6e 67 65 20 | 69 73 20 61 20 73 70 61 |n range |is a spa|
|000009f0| 63 65 2c 20 64 69 73 63 | 61 72 64 20 69 74 0d 09 |ce, disc|ard it..|
|00000a00| 69 66 20 28 57 45 47 65 | 74 43 68 61 72 28 2a 72 |if (WEGe|tChar(*r|
|00000a10| 61 6e 67 65 53 74 61 72 | 74 20 2d 20 31 2c 20 68 |angeStar|t - 1, h|
|00000a20| 57 45 29 20 3d 3d 20 6b | 53 70 61 63 65 29 0d 09 |WE) == k|Space)..|
|00000a30| 7b 0d 09 09 28 2a 72 61 | 6e 67 65 53 74 61 72 74 |{...(*ra|ngeStart|
|00000a40| 29 2d 2d 3b 0d 09 7d 0d | 09 2f 2f 20 65 6c 73 65 |)--;..}.|.// else|
|00000a50| 2c 20 69 66 20 74 68 65 | 20 63 68 61 72 61 63 74 |, if the| charact|
|00000a60| 65 72 20 66 6f 6c 6c 6f | 77 69 6e 67 20 74 68 65 |er follo|wing the|
|00000a70| 20 73 65 6c 65 63 74 69 | 6f 6e 20 72 61 6e 67 65 | selecti|on range|
|00000a80| 20 69 73 20 61 20 73 70 | 61 63 65 2c 20 64 69 73 | is a sp|ace, dis|
|00000a90| 63 61 72 64 20 69 74 0d | 09 65 6c 73 65 20 69 66 |card it.|.else if|
|00000aa0| 20 28 57 45 47 65 74 43 | 68 61 72 28 2a 72 61 6e | (WEGetC|har(*ran|
|00000ab0| 67 65 45 6e 64 2c 20 68 | 57 45 29 20 3d 3d 20 6b |geEnd, h|WE) == k|
|00000ac0| 53 70 61 63 65 29 0d 09 | 7b 0d 09 09 28 2a 72 61 |Space)..|{...(*ra|
|00000ad0| 6e 67 65 45 6e 64 29 2b | 2b 3b 0d 09 7d 0d 7d 0d |ngeEnd)+|+;..}.}.|
|00000ae0| 0d 70 61 73 63 61 6c 20 | 53 49 6e 74 31 36 20 5f |.pascal |SInt16 _|
|00000af0| 57 45 49 6e 74 65 6c 6c | 69 67 65 6e 74 50 61 73 |WEIntell|igentPas|
|00000b00| 74 65 28 53 49 6e 74 33 | 32 20 72 61 6e 67 65 53 |te(SInt3|2 rangeS|
|00000b10| 74 61 72 74 2c 20 53 49 | 6e 74 33 32 20 72 61 6e |tart, SI|nt32 ran|
|00000b20| 67 65 45 6e 64 2c 20 57 | 45 48 61 6e 64 6c 65 20 |geEnd, W|EHandle |
|00000b30| 68 57 45 29 0d 7b 0d 09 | 53 49 6e 74 31 36 20 72 |hWE).{..|SInt16 r|
|00000b40| 65 74 76 61 6c 3b 0d 0d | 09 2f 2f 20 5f 57 45 49 |etval;..|.// _WEI|
|00000b50| 6e 74 65 6c 6c 69 67 65 | 6e 74 50 61 73 74 65 20 |ntellige|ntPaste |
|00000b60| 69 73 20 63 61 6c 6c 65 | 64 20 62 79 20 6f 74 68 |is calle|d by oth|
|00000b70| 65 72 20 57 41 53 54 45 | 20 72 6f 75 74 69 6e 65 |er WASTE| routine|
|00000b80| 73 20 74 6f 20 64 65 74 | 65 72 6d 69 6e 65 20 77 |s to det|ermine w|
|00000b90| 68 65 74 68 65 72 0d 09 | 2f 2f 20 61 6e 20 61 64 |hether..|// an ad|
|00000ba0| 64 69 74 69 6f 6e 61 6c | 20 73 70 61 63 65 20 63 |ditional| space c|
|00000bb0| 68 61 72 61 63 74 65 72 | 20 73 68 6f 75 6c 64 20 |haracter| should |
|00000bc0| 62 65 20 61 64 64 65 64 | 20 28 62 65 66 6f 72 65 |be added| (before|
|00000bd0| 20 6f 72 20 61 66 74 65 | 72 29 20 61 66 74 65 72 | or afte|r) after|
|00000be0| 20 69 6e 73 65 72 74 69 | 6e 67 0d 09 2f 2f 20 6e | inserti|ng..// n|
|00000bf0| 65 77 20 74 65 78 74 20 | 28 75 73 75 61 6c 6c 79 |ew text |(usually|
|00000c00| 20 66 72 6f 6d 20 74 68 | 65 20 43 6c 69 70 62 6f | from th|e Clipbo|
|00000c10| 61 72 64 20 6f 72 20 66 | 72 6f 6d 20 61 20 64 72 |ard or f|rom a dr|
|00000c20| 61 67 29 2e 0d 0d 09 72 | 65 74 76 61 6c 20 3d 20 |ag)....r|etval = |
|00000c30| 77 65 44 6f 6e 74 41 64 | 64 53 70 61 63 65 73 3b |weDontAd|dSpaces;|
|00000c40| 0d 0d 09 2f 2f 20 64 6f | 20 6e 6f 74 68 69 6e 67 |...// do| nothing|
|00000c50| 20 75 6e 6c 65 73 73 20 | 74 68 65 20 69 6e 74 65 | unless |the inte|
|00000c60| 6c 6c 69 67 65 6e 74 20 | 63 75 74 2d 61 6e 64 2d |lligent |cut-and-|
|00000c70| 70 61 73 74 65 20 66 65 | 61 74 75 72 65 20 69 73 |paste fe|ature is|
|00000c80| 20 65 6e 61 62 6c 65 64 | 0d 09 69 66 20 28 21 42 | enabled|..if (!B|
|00000c90| 54 53 54 28 28 2a 68 57 | 45 29 2d 3e 66 65 61 74 |TST((*hW|E)->feat|
|00000ca0| 75 72 65 73 2c 20 77 65 | 46 49 6e 74 43 75 74 41 |ures, we|FIntCutA|
|00000cb0| 6e 64 50 61 73 74 65 29 | 29 0d 09 7b 0d 09 09 72 |ndPaste)|)..{...r|
|00000cc0| 65 74 75 72 6e 20 72 65 | 74 76 61 6c 3b 0d 09 7d |eturn re|tval;..}|
|00000cd0| 0d 0d 09 2f 2f 20 65 78 | 74 72 61 20 73 70 61 63 |...// ex|tra spac|
|00000ce0| 65 73 20 77 69 6c 6c 20 | 62 65 20 61 64 64 65 64 |es will |be added|
|00000cf0| 20 6f 6e 6c 79 20 69 66 | 20 74 68 65 20 70 61 73 | only if| the pas|
|00000d00| 74 65 64 20 74 65 78 74 | 20 6c 6f 6f 6b 73 20 6c |ted text| looks l|
|00000d10| 69 6b 65 20 61 20 77 6f | 72 64 20 72 61 6e 67 65 |ike a wo|rd range|
|00000d20| 2c 0d 09 2f 2f 20 77 69 | 74 68 6f 75 74 20 70 75 |,..// wi|thout pu|
|00000d30| 6e 63 74 75 61 74 69 6f | 6e 20 63 68 61 72 61 63 |nctuatio|n charac|
|00000d40| 74 65 72 73 20 61 74 20 | 74 68 65 20 62 65 67 69 |ters at |the begi|
|00000d50| 6e 6e 69 6e 67 20 6f 72 | 20 61 74 20 74 68 65 20 |nning or| at the |
|00000d60| 65 6e 64 0d 09 69 66 20 | 28 5f 57 45 49 73 50 75 |end..if |(_WEIsPu|
|00000d70| 6e 63 74 28 72 61 6e 67 | 65 53 74 61 72 74 2c 20 |nct(rang|eStart, |
|00000d80| 68 57 45 29 29 0d 09 7b | 0d 09 09 72 65 74 75 72 |hWE))..{|...retur|
|00000d90| 6e 20 72 65 74 76 61 6c | 3b 0d 09 7d 0d 09 69 66 |n retval|;..}..if|
|00000da0| 20 28 5f 57 45 49 73 50 | 75 6e 63 74 28 72 61 6e | (_WEIsP|unct(ran|
|00000db0| 67 65 45 6e 64 20 2d 20 | 31 2c 20 68 57 45 29 29 |geEnd - |1, hWE))|
|00000dc0| 0d 09 7b 0d 09 09 72 65 | 74 75 72 6e 20 72 65 74 |..{...re|turn ret|
|00000dd0| 76 61 6c 3b 0d 09 7d 0d | 0d 09 2f 2f 20 69 66 20 |val;..}.|..// if |
|00000de0| 74 68 65 20 63 68 61 72 | 61 63 74 65 72 20 6f 6e |the char|acter on|
|00000df0| 20 74 68 65 20 6c 65 66 | 74 20 6f 66 20 74 68 65 | the lef|t of the|
|00000e00| 20 70 61 73 74 65 64 20 | 74 65 78 74 20 69 73 20 | pasted |text is |
|00000e10| 61 20 70 75 6e 63 74 75 | 61 74 69 6f 6e 20 63 68 |a punctu|ation ch|
|00000e20| 61 72 61 63 74 65 72 0d | 09 2f 2f 20 61 6e 64 20 |aracter.|.// and |
|00000e30| 74 68 65 20 63 68 61 72 | 61 63 74 65 72 20 6f 6e |the char|acter on|
|00000e40| 20 74 68 65 20 72 69 67 | 68 74 20 69 73 6e 27 74 | the rig|ht isn't|
|00000e50| 2c 20 20 61 64 64 20 61 | 20 73 70 61 63 65 20 6f |, add a| space o|
|00000e60| 6e 20 74 68 65 20 72 69 | 67 68 74 2c 20 61 6e 64 |n the ri|ght, and|
|00000e70| 20 76 69 63 65 20 76 65 | 72 73 61 0d 09 69 66 20 | vice ve|rsa..if |
|00000e80| 28 5f 57 45 49 73 50 75 | 6e 63 74 28 72 61 6e 67 |(_WEIsPu|nct(rang|
|00000e90| 65 53 74 61 72 74 20 2d | 20 31 2c 20 68 57 45 29 |eStart -| 1, hWE)|
|00000ea0| 29 0d 09 7b 0d 09 09 69 | 66 20 28 21 5f 57 45 49 |)..{...i|f (!_WEI|
|00000eb0| 73 50 75 6e 63 74 28 72 | 61 6e 67 65 45 6e 64 2c |sPunct(r|angeEnd,|
|00000ec0| 20 68 57 45 29 29 0d 09 | 09 7b 0d 09 09 09 72 65 | hWE))..|.{....re|
|00000ed0| 74 76 61 6c 20 3d 20 77 | 65 41 64 64 53 70 61 63 |tval = w|eAddSpac|
|00000ee0| 65 4f 6e 52 69 67 68 74 | 53 69 64 65 3b 0d 09 09 |eOnRight|Side;...|
|00000ef0| 7d 0d 09 7d 0d 09 65 6c | 73 65 20 69 66 20 28 5f |}..}..el|se if (_|
|00000f00| 57 45 49 73 50 75 6e 63 | 74 28 72 61 6e 67 65 45 |WEIsPunc|t(rangeE|
|00000f10| 6e 64 2c 20 68 57 45 29 | 29 0d 09 7b 0d 09 09 72 |nd, hWE)|)..{...r|
|00000f20| 65 74 76 61 6c 20 3d 20 | 77 65 41 64 64 53 70 61 |etval = |weAddSpa|
|00000f30| 63 65 4f 6e 4c 65 66 74 | 53 69 64 65 3b 0d 09 7d |ceOnLeft|Side;..}|
|00000f40| 0d 0d 09 72 65 74 75 72 | 6e 20 72 65 74 76 61 6c |...retur|n retval|
|00000f50| 3b 0d 7d 0d 0d 70 61 73 | 63 61 6c 20 4f 53 45 72 |;.}..pas|cal OSEr|
|00000f60| 72 20 5f 57 45 49 6e 73 | 65 72 74 52 75 6e 28 53 |r _WEIns|ertRun(S|
|00000f70| 49 6e 74 33 32 20 72 75 | 6e 49 6e 64 65 78 2c 20 |Int32 ru|nIndex, |
|00000f80| 53 49 6e 74 33 32 20 6f | 66 66 73 65 74 2c 20 53 |SInt32 o|ffset, S|
|00000f90| 49 6e 74 33 32 20 73 74 | 79 6c 65 49 6e 64 65 78 |Int32 st|yleIndex|
|00000fa0| 2c 20 57 45 50 74 72 20 | 70 57 45 29 0d 7b 0d 0d |, WEPtr |pWE).{..|
|00000fb0| 09 2f 2f 20 49 6e 73 65 | 72 74 20 61 20 6e 65 77 |.// Inse|rt a new|
|00000fc0| 20 65 6e 74 72 79 20 69 | 6e 20 74 68 65 20 73 74 | entry i|n the st|
|00000fd0| 79 6c 65 20 72 75 6e 20 | 61 72 72 61 79 2c 20 61 |yle run |array, a|
|00000fe0| 74 20 74 68 65 20 73 70 | 65 63 69 66 69 65 64 20 |t the sp|ecified |
|00000ff0| 72 75 6e 49 6e 64 65 78 | 20 70 6f 73 69 74 69 6f |runIndex| positio|
|00001000| 6e 2e 0d 09 2f 2f 20 54 | 68 65 20 6e 65 77 20 65 |n...// T|he new e|
|00001010| 6e 74 72 79 20 63 6f 6e | 73 69 73 74 73 20 6f 66 |ntry con|sists of|
|00001020| 20 74 68 65 20 70 61 69 | 72 20 3c 6f 66 66 73 65 | the pai|r <offse|
|00001030| 74 2c 20 73 74 79 6c 65 | 49 6e 64 65 78 3e 2e 0d |t, style|Index>..|
|00001040| 0d 09 57 45 52 75 6e 41 | 72 72 61 79 45 6e 74 72 |..WERunA|rrayEntr|
|00001050| 79 20 65 6e 74 72 79 3b | 0d 09 4f 53 45 72 72 20 |y entry;|..OSErr |
|00001060| 65 72 72 3b 0d 0d 09 2f | 2f 20 70 72 65 70 61 72 |err;.../|/ prepar|
|00001070| 65 20 74 68 65 20 65 6e | 74 72 79 20 72 65 63 6f |e the en|try reco|
|00001080| 72 64 20 74 6f 20 62 65 | 20 69 6e 73 65 72 74 65 |rd to be| inserte|
|00001090| 64 20 69 6e 20 74 68 65 | 20 61 72 72 61 79 0d 09 |d in the| array..|
|000010a0| 65 6e 74 72 79 2e 72 75 | 6e 53 74 61 72 74 20 3d |entry.ru|nStart =|
|000010b0| 20 6f 66 66 73 65 74 3b | 0d 09 65 6e 74 72 79 2e | offset;|..entry.|
|000010c0| 73 74 79 6c 65 49 6e 64 | 65 78 20 3d 20 73 74 79 |styleInd|ex = sty|
|000010d0| 6c 65 49 6e 64 65 78 3b | 0d 0d 09 2f 2f 20 64 6f |leIndex;|...// do|
|000010e0| 20 74 68 65 20 69 6e 73 | 65 72 74 69 6f 6e 0d 09 | the ins|ertion..|
|000010f0| 69 66 20 28 28 65 72 72 | 20 3d 20 5f 57 45 53 70 |if ((err| = _WESp|
|00001100| 6c 69 63 65 28 28 48 61 | 6e 64 6c 65 29 20 70 57 |lice((Ha|ndle) pW|
|00001110| 45 2d 3e 68 52 75 6e 73 | 2c 20 26 65 6e 74 72 79 |E->hRuns|, &entry|
|00001120| 2c 20 73 69 7a 65 6f 66 | 28 65 6e 74 72 79 29 2c |, sizeof|(entry),|
|00001130| 20 28 72 75 6e 49 6e 64 | 65 78 20 2b 20 31 29 20 | (runInd|ex + 1) |
|00001140| 2a 20 73 69 7a 65 6f 66 | 28 65 6e 74 72 79 29 29 |* sizeof|(entry))|
|00001150| 29 20 21 3d 20 6e 6f 45 | 72 72 29 0d 09 7b 0d 09 |) != noE|rr)..{..|
|00001160| 09 72 65 74 75 72 6e 20 | 65 72 72 3b 0d 09 7d 0d |.return |err;..}.|
|00001170| 0d 09 2f 2f 20 69 6e 63 | 72 65 6d 65 6e 74 20 73 |..// inc|rement s|
|00001180| 74 79 6c 65 20 72 75 6e | 20 63 6f 75 6e 74 0d 09 |tyle run| count..|
|00001190| 70 57 45 2d 3e 6e 52 75 | 6e 73 2b 2b 3b 0d 0d 09 |pWE->nRu|ns++;...|
|000011a0| 2f 2f 20 69 6e 63 72 65 | 6d 65 6e 74 20 74 68 65 |// incre|ment the|
|000011b0| 20 72 65 66 65 72 65 6e | 63 65 20 63 6f 75 6e 74 | referen|ce count|
|000011c0| 20 66 69 65 6c 64 20 6f | 66 20 74 68 65 20 73 74 | field o|f the st|
|000011d0| 79 6c 65 20 74 61 62 6c | 65 20 65 6e 74 72 79 0d |yle tabl|e entry.|
|000011e0| 09 2f 2f 20 72 65 66 65 | 72 65 6e 63 65 64 20 62 |.// refe|renced b|
|000011f0| 79 20 74 68 65 20 6e 65 | 77 6c 79 20 69 6e 73 65 |y the ne|wly inse|
|00001200| 72 74 65 64 20 73 74 79 | 6c 65 20 72 75 6e 0d 09 |rted sty|le run..|
|00001210| 28 2a 70 57 45 2d 3e 68 | 53 74 79 6c 65 73 29 5b |(*pWE->h|Styles)[|
|00001220| 73 74 79 6c 65 49 6e 64 | 65 78 5d 2e 72 65 66 43 |styleInd|ex].refC|
|00001230| 6f 75 6e 74 2b 2b 3b 0d | 0d 09 72 65 74 75 72 6e |ount++;.|..return|
|00001240| 20 6e 6f 45 72 72 3b 0d | 7d 0d 0d 70 61 73 63 61 | noErr;.|}..pasca|
|00001250| 6c 20 76 6f 69 64 20 5f | 57 45 52 65 6d 6f 76 65 |l void _|WERemove|
|00001260| 52 75 6e 28 53 49 6e 74 | 33 32 20 72 75 6e 49 6e |Run(SInt|32 runIn|
|00001270| 64 65 78 2c 20 57 45 50 | 74 72 20 70 57 45 29 0d |dex, WEP|tr pWE).|
|00001280| 7b 0d 09 57 45 53 74 79 | 6c 65 54 61 62 6c 65 45 |{..WESty|leTableE|
|00001290| 6e 74 72 79 20 2a 70 53 | 74 79 6c 65 3b 0d 0d 09 |ntry *pS|tyle;...|
|000012a0| 2f 2f 20 67 65 74 20 61 | 20 70 6f 69 6e 74 65 72 |// get a| pointer|
|000012b0| 20 74 6f 20 74 68 65 20 | 73 74 79 6c 65 20 74 61 | to the |style ta|
|000012c0| 62 6c 65 20 65 6e 74 72 | 79 20 72 65 66 65 72 65 |ble entr|y refere|
|000012d0| 6e 63 65 64 20 62 79 20 | 74 68 65 20 73 74 79 6c |nced by |the styl|
|000012e0| 65 20 72 75 6e 0d 09 70 | 53 74 79 6c 65 20 3d 20 |e run..p|Style = |
|000012f0| 2a 70 57 45 2d 3e 68 53 | 74 79 6c 65 73 20 2b 20 |*pWE->hS|tyles + |
|00001300| 28 2a 70 57 45 2d 3e 68 | 52 75 6e 73 29 5b 72 75 |(*pWE->h|Runs)[ru|
|00001310| 6e 49 6e 64 65 78 5d 2e | 73 74 79 6c 65 49 6e 64 |nIndex].|styleInd|
|00001320| 65 78 3b 0d 0d 09 2f 2f | 20 64 65 63 72 65 6d 65 |ex;...//| decreme|
|00001330| 6e 74 20 74 68 65 20 72 | 65 66 65 72 65 6e 63 65 |nt the r|eference|
|00001340| 20 63 6f 75 6e 74 20 66 | 69 65 6c 64 20 6f 66 20 | count f|ield of |
|00001350| 74 68 65 20 73 74 79 6c | 65 20 74 61 62 6c 65 20 |the styl|e table |
|00001360| 65 6e 74 72 79 0d 09 2f | 2f 20 72 65 66 65 72 65 |entry../|/ refere|
|00001370| 6e 63 65 64 20 62 79 20 | 74 68 65 20 73 74 79 6c |nced by |the styl|
|00001380| 65 20 72 75 6e 20 74 6f | 20 62 65 20 72 65 6d 6f |e run to| be remo|
|00001390| 76 65 64 0d 09 70 53 74 | 79 6c 65 2d 3e 72 65 66 |ved..pSt|yle->ref|
|000013a0| 43 6f 75 6e 74 2d 2d 3b | 0d 0d 23 69 66 20 57 41 |Count--;|..#if WA|
|000013b0| 53 54 45 5f 4f 42 4a 45 | 43 54 53 0d 09 2f 2f 20 |STE_OBJE|CTS..// |
|000013c0| 64 69 73 70 6f 73 65 20 | 6f 66 20 74 68 65 20 65 |dispose |of the e|
|000013d0| 6d 62 65 64 64 65 64 20 | 6f 62 6a 65 63 74 20 28 |mbedded |object (|
|000013e0| 69 66 20 61 6e 79 29 0d | 09 69 66 20 28 70 53 74 |if any).|.if (pSt|
|000013f0| 79 6c 65 2d 3e 69 6e 66 | 6f 2e 72 75 6e 53 74 79 |yle->inf|o.runSty|
|00001400| 6c 65 2e 74 73 4f 62 6a | 65 63 74 20 21 3d 20 6e |le.tsObj|ect != n|
|00001410| 69 6c 29 0d 09 7b 0d 09 | 09 5f 57 45 46 72 65 65 |il)..{..|._WEFree|
|00001420| 4f 62 6a 65 63 74 28 70 | 53 74 79 6c 65 2d 3e 69 |Object(p|Style->i|
|00001430| 6e 66 6f 2e 72 75 6e 53 | 74 79 6c 65 2e 74 73 4f |nfo.runS|tyle.tsO|
|00001440| 62 6a 65 63 74 29 3b 0d | 09 09 70 53 74 79 6c 65 |bject);.|..pStyle|
|00001450| 2d 3e 69 6e 66 6f 2e 72 | 75 6e 53 74 79 6c 65 2e |->info.r|unStyle.|
|00001460| 74 73 4f 62 6a 65 63 74 | 20 3d 20 6e 69 6c 3b 0d |tsObject| = nil;.|
|00001470| 09 7d 0d 23 65 6e 64 69 | 66 0d 0d 09 2f 2f 20 72 |.}.#endi|f...// r|
|00001480| 65 6d 6f 76 65 20 61 20 | 22 73 6c 6f 74 22 20 66 |emove a |"slot" f|
|00001490| 72 6f 6d 20 74 68 65 20 | 72 75 6e 20 61 72 72 61 |rom the |run arra|
|000014a0| 79 0d 09 5f 57 45 53 70 | 6c 69 63 65 28 28 48 61 |y.._WESp|lice((Ha|
|000014b0| 6e 64 6c 65 29 20 70 57 | 45 2d 3e 68 52 75 6e 73 |ndle) pW|E->hRuns|
|000014c0| 2c 20 6e 69 6c 2c 20 2d | 20 73 69 7a 65 6f 66 28 |, nil, -| sizeof(|
|000014d0| 57 45 52 75 6e 41 72 72 | 61 79 45 6e 74 72 79 29 |WERunArr|ayEntry)|
|000014e0| 2c 20 72 75 6e 49 6e 64 | 65 78 20 2a 20 73 69 7a |, runInd|ex * siz|
|000014f0| 65 6f 66 28 57 45 52 75 | 6e 41 72 72 61 79 45 6e |eof(WERu|nArrayEn|
|00001500| 74 72 79 29 29 3b 0d 0d | 09 2f 2f 20 64 65 63 72 |try));..|.// decr|
|00001510| 65 6d 65 6e 74 20 73 74 | 79 6c 65 20 72 75 6e 20 |ement st|yle run |
|00001520| 63 6f 75 6e 74 0d 09 70 | 57 45 2d 3e 6e 52 75 6e |count..p|WE->nRun|
|00001530| 73 2d 2d 3b 0d 7d 0d 0d | 70 61 73 63 61 6c 20 76 |s--;.}..|pascal v|
|00001540| 6f 69 64 20 5f 57 45 43 | 68 61 6e 67 65 52 75 6e |oid _WEC|hangeRun|
|00001550| 28 53 49 6e 74 33 32 20 | 72 75 6e 49 6e 64 65 78 |(SInt32 |runIndex|
|00001560| 2c 20 53 49 6e 74 33 32 | 20 6e 65 77 53 74 79 6c |, SInt32| newStyl|
|00001570| 65 49 6e 64 65 78 2c 20 | 42 6f 6f 6c 65 61 6e 20 |eIndex, |Boolean |
|00001580| 6b 65 65 70 4f 6c 64 2c | 20 57 45 50 74 72 20 70 |keepOld,| WEPtr p|
|00001590| 57 45 29 0d 7b 0d 23 69 | 66 20 21 57 41 53 54 45 |WE).{.#i|f !WASTE|
|000015a0| 5f 4f 42 4a 45 43 54 53 | 0d 09 23 70 72 61 67 6d |_OBJECTS|..#pragm|
|000015b0| 61 20 75 6e 75 73 65 64 | 28 6b 65 65 70 4f 6c 64 |a unused|(keepOld|
|000015c0| 29 0d 23 65 6e 64 69 66 | 0d 09 2f 2f 20 63 68 61 |).#endif|..// cha|
|000015d0| 6e 67 65 20 74 68 65 20 | 73 74 79 6c 65 49 6e 64 |nge the |styleInd|
|000015e0| 65 78 20 66 69 65 6c 64 | 20 6f 66 20 74 68 65 20 |ex field| of the |
|000015f0| 73 70 65 63 69 66 69 65 | 64 20 65 6e 74 72 79 20 |specifie|d entry |
|00001600| 6f 66 20 74 68 65 20 73 | 74 79 6c 65 20 72 75 6e |of the s|tyle run|
|00001610| 20 61 72 72 61 79 0d 0d | 09 53 49 6e 74 33 32 20 | array..|.SInt32 |
|00001620| 6f 6c 64 53 74 79 6c 65 | 49 6e 64 65 78 3b 0d 09 |oldStyle|Index;..|
|00001630| 57 45 53 74 79 6c 65 54 | 61 62 6c 65 45 6e 74 72 |WEStyleT|ableEntr|
|00001640| 79 20 2a 6f 6c 64 53 74 | 79 6c 65 2c 20 2a 6e 65 |y *oldSt|yle, *ne|
|00001650| 77 53 74 79 6c 65 3b 0d | 0d 09 2f 2f 20 64 6f 20 |wStyle;.|..// do |
|00001660| 74 68 65 20 63 68 61 6e | 67 65 0d 09 6f 6c 64 53 |the chan|ge..oldS|
|00001670| 74 79 6c 65 49 6e 64 65 | 78 20 3d 20 28 2a 70 57 |tyleInde|x = (*pW|
|00001680| 45 2d 3e 68 52 75 6e 73 | 29 5b 72 75 6e 49 6e 64 |E->hRuns|)[runInd|
|00001690| 65 78 5d 2e 73 74 79 6c | 65 49 6e 64 65 78 3b 0d |ex].styl|eIndex;.|
|000016a0| 09 28 2a 70 57 45 2d 3e | 68 52 75 6e 73 29 5b 72 |.(*pWE->|hRuns)[r|
|000016b0| 75 6e 49 6e 64 65 78 5d | 2e 73 74 79 6c 65 49 6e |unIndex]|.styleIn|
|000016c0| 64 65 78 20 3d 20 6e 65 | 77 53 74 79 6c 65 49 6e |dex = ne|wStyleIn|
|000016d0| 64 65 78 3b 0d 0d 09 2f | 2f 20 67 65 74 20 70 6f |dex;.../|/ get po|
|000016e0| 69 6e 74 65 72 73 20 74 | 6f 20 6f 6c 64 20 61 6e |inters t|o old an|
|000016f0| 64 20 6e 65 77 20 73 74 | 79 6c 65 20 74 61 62 6c |d new st|yle tabl|
|00001700| 65 20 65 6c 65 6d 65 6e | 74 73 0d 09 6f 6c 64 53 |e elemen|ts..oldS|
|00001710| 74 79 6c 65 20 3d 20 2a | 70 57 45 2d 3e 68 53 74 |tyle = *|pWE->hSt|
|00001720| 79 6c 65 73 20 2b 20 6f | 6c 64 53 74 79 6c 65 49 |yles + o|ldStyleI|
|00001730| 6e 64 65 78 3b 0d 09 6e | 65 77 53 74 79 6c 65 20 |ndex;..n|ewStyle |
|00001740| 3d 20 2a 70 57 45 2d 3e | 68 53 74 79 6c 65 73 20 |= *pWE->|hStyles |
|00001750| 2b 20 6e 65 77 53 74 79 | 6c 65 49 6e 64 65 78 3b |+ newSty|leIndex;|
|00001760| 0d 0d 09 2f 2f 20 69 6e | 63 72 65 6d 65 6e 74 20 |...// in|crement |
|00001770| 74 68 65 20 72 65 66 65 | 72 65 6e 63 65 20 63 6f |the refe|rence co|
|00001780| 75 6e 74 20 66 69 65 6c | 64 20 6f 66 20 74 68 65 |unt fiel|d of the|
|00001790| 20 6e 65 77 20 73 74 79 | 6c 65 20 74 61 62 6c 65 | new sty|le table|
|000017a0| 20 65 6e 74 72 79 0d 09 | 6e 65 77 53 74 79 6c 65 | entry..|newStyle|
|000017b0| 2d 3e 72 65 66 43 6f 75 | 6e 74 2b 2b 3b 0d 0d 09 |->refCou|nt++;...|
|000017c0| 2f 2f 20 64 65 63 72 65 | 6d 65 6e 74 20 74 68 65 |// decre|ment the|
|000017d0| 20 72 65 66 65 72 65 6e | 63 65 20 63 6f 75 6e 74 | referen|ce count|
|000017e0| 20 66 69 65 6c 64 20 6f | 66 20 74 68 65 20 6f 6c | field o|f the ol|
|000017f0| 64 20 73 74 79 6c 65 20 | 74 61 62 6c 65 20 65 6e |d style |table en|
|00001800| 74 72 79 0d 09 6f 6c 64 | 53 74 79 6c 65 2d 3e 72 |try..old|Style->r|
|00001810| 65 66 43 6f 75 6e 74 2d | 2d 3b 0d 0d 23 69 66 20 |efCount-|-;..#if |
|00001820| 57 41 53 54 45 5f 4f 42 | 4a 45 43 54 53 0d 09 2f |WASTE_OB|JECTS../|
|00001830| 2f 20 64 69 73 70 6f 73 | 65 20 6f 66 20 74 68 65 |/ dispos|e of the|
|00001840| 20 65 6d 62 65 64 64 65 | 64 20 6f 62 6a 65 63 74 | embedde|d object|
|00001850| 20 28 69 66 20 61 6e 79 | 29 20 75 6e 6c 65 73 73 | (if any|) unless|
|00001860| 20 69 74 20 69 73 20 61 | 67 61 69 6e 20 72 65 66 | it is a|gain ref|
|00001870| 65 72 65 6e 63 65 64 20 | 69 6e 20 74 68 65 20 6e |erenced |in the n|
|00001880| 65 77 20 73 74 79 6c 65 | 0d 09 69 66 20 28 21 6b |ew style|..if (!k|
|00001890| 65 65 70 4f 6c 64 29 0d | 09 7b 0d 09 09 57 45 4f |eepOld).|.{...WEO|
|000018a0| 62 6a 65 63 74 44 65 73 | 63 48 61 6e 64 6c 65 20 |bjectDes|cHandle |
|000018b0| 6f 6c 64 4f 62 6a 65 63 | 74 20 3d 20 6f 6c 64 53 |oldObjec|t = oldS|
|000018c0| 74 79 6c 65 2d 3e 69 6e | 66 6f 2e 72 75 6e 53 74 |tyle->in|fo.runSt|
|000018d0| 79 6c 65 2e 74 73 4f 62 | 6a 65 63 74 3b 0d 0d 09 |yle.tsOb|ject;...|
|000018e0| 09 69 66 20 28 28 6f 6c | 64 4f 62 6a 65 63 74 20 |.if ((ol|dObject |
|000018f0| 21 3d 20 6e 69 6c 29 20 | 26 26 20 28 6f 6c 64 4f |!= nil) |&& (oldO|
|00001900| 62 6a 65 63 74 20 21 3d | 20 6e 65 77 53 74 79 6c |bject !=| newStyl|
|00001910| 65 2d 3e 69 6e 66 6f 2e | 72 75 6e 53 74 79 6c 65 |e->info.|runStyle|
|00001920| 2e 74 73 4f 62 6a 65 63 | 74 29 29 0d 09 09 7b 0d |.tsObjec|t))...{.|
|00001930| 09 09 09 5f 57 45 46 72 | 65 65 4f 62 6a 65 63 74 |..._WEFr|eeObject|
|00001940| 28 6f 6c 64 4f 62 6a 65 | 63 74 29 3b 0d 09 09 7d |(oldObje|ct);...}|
|00001950| 0d 09 7d 0d 23 65 6e 64 | 69 66 0d 7d 0d 0d 70 61 |..}.#end|if.}..pa|
|00001960| 73 63 61 6c 20 4f 53 45 | 72 72 20 5f 57 45 4e 65 |scal OSE|rr _WENe|
|00001970| 77 53 74 79 6c 65 28 63 | 6f 6e 73 74 20 57 45 54 |wStyle(c|onst WET|
|00001980| 65 78 74 53 74 79 6c 65 | 20 2a 74 73 2c 20 53 49 |extStyle| *ts, SI|
|00001990| 6e 74 33 32 20 2a 73 74 | 79 6c 65 49 6e 64 65 78 |nt32 *st|yleIndex|
|000019a0| 2c 20 57 45 50 74 72 20 | 70 57 45 29 0d 7b 0d 09 |, WEPtr |pWE).{..|
|000019b0| 2f 2f 20 67 69 76 65 6e | 20 74 68 65 20 73 70 65 |// given| the spe|
|000019c0| 63 69 66 69 65 64 20 57 | 45 54 65 78 74 53 74 79 |cified W|ETextSty|
|000019d0| 6c 65 20 72 65 63 6f 72 | 64 2c 20 66 69 6e 64 20 |le recor|d, find |
|000019e0| 74 68 65 20 63 6f 72 72 | 65 73 70 6f 6e 64 69 6e |the corr|espondin|
|000019f0| 67 20 65 6e 74 72 79 0d | 09 2f 2f 20 69 6e 20 74 |g entry.|.// in t|
|00001a00| 68 65 20 73 74 79 6c 65 | 20 74 61 62 6c 65 20 28 |he style| table (|
|00001a10| 63 72 65 61 74 65 20 61 | 20 6e 65 77 20 65 6e 74 |create a| new ent|
|00001a20| 72 79 20 69 66 20 6e 65 | 63 65 73 73 61 72 79 29 |ry if ne|cessary)|
|00001a30| 2c 20 61 6e 64 20 72 65 | 74 75 72 6e 20 69 74 73 |, and re|turn its|
|00001a40| 20 69 6e 64 65 78 0d 0d | 09 57 45 53 74 79 6c 65 | index..|.WEStyle|
|00001a50| 54 61 62 6c 65 45 6e 74 | 72 79 20 2a 70 45 6e 74 |TableEnt|ry *pEnt|
|00001a60| 72 79 3b 0d 09 57 45 53 | 74 79 6c 65 54 61 62 6c |ry;..WES|tyleTabl|
|00001a70| 65 45 6e 74 72 79 20 65 | 6e 74 72 79 3b 0d 09 53 |eEntry e|ntry;..S|
|00001a80| 49 6e 74 33 32 20 69 6e | 64 65 78 3b 0d 09 53 49 |Int32 in|dex;..SI|
|00001a90| 6e 74 33 32 20 75 6e 75 | 73 65 64 49 6e 64 65 78 |nt32 unu|sedIndex|
|00001aa0| 3b 0d 09 4f 53 45 72 72 | 20 65 72 72 3b 0d 0d 09 |;..OSErr| err;...|
|00001ab0| 2f 2f 20 73 65 65 20 69 | 66 20 74 68 65 20 67 69 |// see i|f the gi|
|00001ac0| 76 65 6e 20 73 74 79 6c | 65 20 61 6c 72 65 61 64 |ven styl|e alread|
|00001ad0| 79 20 65 78 69 73 74 73 | 20 69 6e 20 74 68 65 20 |y exists| in the |
|00001ae0| 73 74 79 6c 65 20 74 61 | 62 6c 65 0d 09 2f 2f 20 |style ta|ble..// |
|00001af0| 77 68 69 6c 65 20 73 63 | 61 6e 6e 69 6e 67 20 74 |while sc|anning t|
|00001b00| 68 65 20 74 61 62 6c 65 | 2c 20 61 6c 73 6f 20 72 |he table|, also r|
|00001b10| 65 6d 65 6d 62 65 72 20 | 74 68 65 20 70 6f 73 69 |emember |the posi|
|00001b20| 74 69 6f 6e 20 6f 66 20 | 74 68 65 20 66 69 72 73 |tion of |the firs|
|00001b30| 74 20 75 6e 75 73 65 64 | 20 73 74 79 6c 65 2c 20 |t unused| style, |
|00001b40| 69 66 20 61 6e 79 0d 09 | 75 6e 75 73 65 64 49 6e |if any..|unusedIn|
|00001b50| 64 65 78 20 3d 20 2d 31 | 3b 0d 09 70 45 6e 74 72 |dex = -1|;..pEntr|
|00001b60| 79 20 3d 20 2a 70 57 45 | 2d 3e 68 53 74 79 6c 65 |y = *pWE|->hStyle|
|00001b70| 73 3b 0d 09 66 6f 72 20 | 28 20 69 6e 64 65 78 20 |s;..for |( index |
|00001b80| 3d 20 30 20 3b 20 69 6e | 64 65 78 20 3c 20 70 57 |= 0 ; in|dex < pW|
|00001b90| 45 2d 3e 6e 53 74 79 6c | 65 73 20 3b 20 69 6e 64 |E->nStyl|es ; ind|
|00001ba0| 65 78 2b 2b 20 29 0d 09 | 7b 0d 09 09 2f 2f 20 63 |ex++ )..|{...// c|
|00001bb0| 68 65 63 6b 20 66 6f 72 | 20 65 6e 74 72 69 65 73 |heck for| entries|
|00001bc0| 20 77 68 69 63 68 20 61 | 72 65 6e 27 74 20 72 65 | which a|ren't re|
|00001bd0| 66 65 72 65 6e 63 65 64 | 20 61 6e 64 20 63 61 6e |ferenced| and can|
|00001be0| 20 62 65 20 72 65 63 79 | 63 6c 65 64 0d 09 09 69 | be recy|cled...i|
|00001bf0| 66 20 28 28 70 45 6e 74 | 72 79 2d 3e 72 65 66 43 |f ((pEnt|ry->refC|
|00001c00| 6f 75 6e 74 20 3d 3d 20 | 30 29 20 26 26 20 28 75 |ount == |0) && (u|
|00001c10| 6e 75 73 65 64 49 6e 64 | 65 78 20 3d 3d 20 2d 31 |nusedInd|ex == -1|
|00001c20| 29 29 0d 09 09 7b 0d 09 | 09 09 75 6e 75 73 65 64 |))...{..|..unused|
|00001c30| 49 6e 64 65 78 20 3d 20 | 69 6e 64 65 78 3b 0d 09 |Index = |index;..|
|00001c40| 09 7d 0d 0d 09 09 2f 2f | 20 70 65 72 66 6f 72 6d |.}....//| perform|
|00001c50| 20 61 20 62 69 74 77 69 | 73 65 20 63 6f 6d 70 61 | a bitwi|se compa|
|00001c60| 72 69 73 6f 6e 20 62 65 | 74 77 65 65 6e 20 74 68 |rison be|tween th|
|00001c70| 65 20 63 75 72 72 65 6e | 74 20 65 6e 74 72 79 20 |e curren|t entry |
|00001c80| 61 6e 64 20 74 68 65 20 | 73 70 65 63 69 66 69 65 |and the |specifie|
|00001c90| 64 20 73 74 79 6c 65 0d | 09 09 2f 2f 20 28 61 63 |d style.|..// (ac|
|00001ca0| 74 75 61 6c 6c 79 2c 20 | 77 65 20 69 67 6e 6f 72 |tually, |we ignor|
|00001cb0| 65 20 6d 65 74 72 69 63 | 73 20 69 6e 66 6f 72 6d |e metric|s inform|
|00001cc0| 61 74 69 6f 6e 29 0d 09 | 09 65 6c 73 65 20 69 66 |ation)..|.else if|
|00001cd0| 20 28 5f 57 45 42 6c 6f | 63 6b 43 6d 70 28 26 70 | (_WEBlo|ckCmp(&p|
|00001ce0| 45 6e 74 72 79 2d 3e 69 | 6e 66 6f 2e 72 75 6e 53 |Entry->i|nfo.runS|
|00001cf0| 74 79 6c 65 2c 20 74 73 | 2c 20 73 69 7a 65 6f 66 |tyle, ts|, sizeof|
|00001d00| 28 57 45 54 65 78 74 53 | 74 79 6c 65 29 29 29 0d |(WETextS|tyle))).|
|00001d10| 09 09 7b 0d 09 09 09 2f | 2f 20 66 6f 75 6e 64 3a |..{..../|/ found:|
|00001d20| 20 73 74 79 6c 65 20 61 | 6c 72 65 61 64 79 20 70 | style a|lready p|
|00001d30| 72 65 73 65 6e 74 0d 09 | 09 09 2a 73 74 79 6c 65 |resent..|..*style|
|00001d40| 49 6e 64 65 78 20 3d 20 | 69 6e 64 65 78 3b 0d 09 |Index = |index;..|
|00001d50| 09 09 72 65 74 75 72 6e | 20 6e 6f 45 72 72 3b 0d |..return| noErr;.|
|00001d60| 09 09 7d 0d 09 09 70 45 | 6e 74 72 79 2b 2b 3b 0d |..}...pE|ntry++;.|
|00001d70| 09 7d 20 2f 2f 20 66 6f | 72 0d 0d 09 2f 2f 20 74 |.} // fo|r...// t|
|00001d80| 68 65 20 73 70 65 63 69 | 66 69 65 64 20 73 74 79 |he speci|fied sty|
|00001d90| 6c 65 20 64 6f 65 73 6e | 27 74 20 65 78 69 73 74 |le doesn|'t exist|
|00001da0| 20 69 6e 20 74 68 65 20 | 73 74 79 6c 65 20 74 61 | in the |style ta|
|00001db0| 62 6c 65 0d 09 2f 2f 20 | 73 69 6e 63 65 20 74 68 |ble..// |since th|
|00001dc0| 69 73 20 69 73 20 61 20 | 6e 65 77 20 65 6e 74 72 |is is a |new entr|
|00001dd0| 79 2c 20 77 65 20 68 61 | 76 65 20 74 6f 20 63 61 |y, we ha|ve to ca|
|00001de0| 6c 63 75 6c 61 74 65 20 | 66 6f 6e 74 20 6d 65 74 |lculate |font met|
|00001df0| 72 69 63 73 20 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |rics inf|ormation|
|00001e00| 0d 09 65 6e 74 72 79 2e | 69 6e 66 6f 2e 72 75 6e |..entry.|info.run|
|00001e10| 53 74 79 6c 65 20 3d 20 | 2a 74 73 3b 0d 09 5f 57 |Style = |*ts;.._W|
|00001e20| 45 46 69 6c 6c 46 6f 6e | 74 49 6e 66 6f 28 70 57 |EFillFon|tInfo(pW|
|00001e30| 45 2d 3e 70 6f 72 74 2c | 20 26 65 6e 74 72 79 2e |E->port,| &entry.|
|00001e40| 69 6e 66 6f 29 3b 0d 23 | 69 66 20 57 41 53 54 45 |info);.#|if WASTE|
|00001e50| 5f 53 43 41 4c 45 0d 09 | 65 6e 74 72 79 2e 69 6e |_SCALE..|entry.in|
|00001e60| 66 6f 2e 72 75 6e 48 65 | 69 67 68 74 20 3d 20 28 |fo.runHe|ight = (|
|00001e70| 65 6e 74 72 79 2e 69 6e | 66 6f 2e 72 75 6e 48 65 |entry.in|fo.runHe|
|00001e80| 69 67 68 74 20 2a 20 70 | 57 45 2d 3e 73 63 61 6c |ight * p|WE->scal|
|00001e90| 65 4e 75 6d 65 72 2e 76 | 29 20 2f 20 70 57 45 2d |eNumer.v|) / pWE-|
|00001ea0| 3e 73 63 61 6c 65 44 65 | 6e 6f 6d 2e 76 3b 0d 09 |>scaleDe|nom.v;..|
|00001eb0| 65 6e 74 72 79 2e 69 6e | 66 6f 2e 72 75 6e 41 73 |entry.in|fo.runAs|
|00001ec0| 63 65 6e 74 20 3d 20 28 | 65 6e 74 72 79 2e 69 6e |cent = (|entry.in|
|00001ed0| 66 6f 2e 72 75 6e 41 73 | 63 65 6e 74 20 2a 20 70 |fo.runAs|cent * p|
|00001ee0| 57 45 2d 3e 73 63 61 6c | 65 4e 75 6d 65 72 2e 76 |WE->scal|eNumer.v|
|00001ef0| 29 20 2f 20 70 57 45 2d | 3e 73 63 61 6c 65 44 65 |) / pWE-|>scaleDe|
|00001f00| 6e 6f 6d 2e 76 3b 0d 23 | 65 6e 64 69 66 0d 0d 09 |nom.v;.#|endif...|
|00001f10| 2f 2f 20 73 65 65 20 69 | 66 20 77 65 20 63 61 6e |// see i|f we can|
|00001f20| 20 72 65 63 79 63 6c 65 | 20 61 6e 20 75 6e 75 73 | recycle| an unus|
|00001f30| 65 64 20 65 6e 74 72 79 | 0d 09 69 66 20 28 75 6e |ed entry|..if (un|
|00001f40| 75 73 65 64 49 6e 64 65 | 78 20 3e 3d 20 30 29 0d |usedInde|x >= 0).|
|00001f50| 09 7b 0d 09 09 69 6e 64 | 65 78 20 3d 20 75 6e 75 |.{...ind|ex = unu|
|00001f60| 73 65 64 49 6e 64 65 78 | 3b 0d 09 09 28 2a 70 57 |sedIndex|;...(*pW|
|00001f70| 45 2d 3e 68 53 74 79 6c | 65 73 29 5b 69 6e 64 65 |E->hStyl|es)[inde|
|00001f80| 78 5d 2e 69 6e 66 6f 20 | 3d 20 65 6e 74 72 79 2e |x].info |= entry.|
|00001f90| 69 6e 66 6f 3b 0d 09 7d | 0d 09 65 6c 73 65 0d 09 |info;..}|..else..|
|00001fa0| 7b 0d 09 09 2f 2f 20 6e | 6f 20 72 65 75 73 61 62 |{...// n|o reusab|
|00001fb0| 6c 65 20 65 6e 74 72 79 | 3a 20 77 65 20 68 61 76 |le entry|: we hav|
|00001fc0| 65 20 74 6f 20 61 70 70 | 65 6e 64 20 61 20 6e 65 |e to app|end a ne|
|00001fd0| 77 20 65 6e 74 72 79 20 | 61 74 20 74 68 65 20 65 |w entry |at the e|
|00001fe0| 6e 64 20 6f 66 20 74 68 | 65 20 74 61 62 6c 65 0d |nd of th|e table.|
|00001ff0| 09 09 65 6e 74 72 79 2e | 72 65 66 43 6f 75 6e 74 |..entry.|refCount|
|00002000| 20 3d 20 30 3b 0d 09 09 | 69 66 20 28 28 65 72 72 | = 0;...|if ((err|
|00002010| 20 3d 20 5f 57 45 53 70 | 6c 69 63 65 28 28 48 61 | = _WESp|lice((Ha|
|00002020| 6e 64 6c 65 29 20 70 57 | 45 2d 3e 68 53 74 79 6c |ndle) pW|E->hStyl|
|00002030| 65 73 2c 20 26 65 6e 74 | 72 79 2c 20 73 69 7a 65 |es, &ent|ry, size|
|00002040| 6f 66 28 65 6e 74 72 79 | 29 2c 20 2d 31 29 29 20 |of(entry|), -1)) |
|00002050| 21 3d 20 6e 6f 45 72 72 | 29 0d 09 09 7b 0d 09 09 |!= noErr|)...{...|
|00002060| 09 72 65 74 75 72 6e 20 | 65 72 72 3b 0d 09 09 7d |.return |err;...}|
|00002070| 0d 0d 09 09 2f 2f 20 75 | 70 64 61 74 65 20 73 74 |....// u|pdate st|
|00002080| 79 6c 65 20 63 6f 75 6e | 74 20 69 6e 20 74 68 65 |yle coun|t in the|
|00002090| 20 57 45 20 72 65 63 6f | 72 64 0d 09 09 70 57 45 | WE reco|rd...pWE|
|000020a0| 2d 3e 6e 53 74 79 6c 65 | 73 2b 2b 3b 0d 09 7d 0d |->nStyle|s++;..}.|
|000020b0| 0d 09 2f 2f 20 72 65 74 | 75 72 6e 20 74 68 65 20 |..// ret|urn the |
|000020c0| 69 6e 64 65 78 20 74 6f | 20 74 68 65 20 6e 65 77 |index to| the new|
|000020d0| 20 65 6e 74 72 79 0d 09 | 2a 73 74 79 6c 65 49 6e | entry..|*styleIn|
|000020e0| 64 65 78 20 3d 20 69 6e | 64 65 78 3b 0d 09 72 65 |dex = in|dex;..re|
|000020f0| 74 75 72 6e 20 6e 6f 45 | 72 72 3b 0d 7d 0d 0d 70 |turn noE|rr;.}..p|
|00002100| 61 73 63 61 6c 20 4f 53 | 45 72 72 20 5f 57 45 52 |ascal OS|Err _WER|
|00002110| 65 64 72 61 77 28 53 49 | 6e 74 33 32 20 72 61 6e |edraw(SI|nt32 ran|
|00002120| 67 65 53 74 61 72 74 2c | 20 53 49 6e 74 33 32 20 |geStart,| SInt32 |
|00002130| 72 61 6e 67 65 45 6e 64 | 2c 20 57 45 48 61 6e 64 |rangeEnd|, WEHand|
|00002140| 6c 65 20 68 57 45 29 0d | 7b 0d 09 57 45 50 74 72 |le hWE).|{..WEPtr|
|00002150| 20 70 57 45 20 3d 20 2a | 68 57 45 3b 09 09 2f 2f | pWE = *|hWE;..//|
|00002160| 20 61 73 73 75 6d 65 20 | 57 45 20 72 65 63 6f 72 | assume |WE recor|
|00002170| 64 20 69 73 20 61 6c 72 | 65 61 64 79 20 6c 6f 63 |d is alr|eady loc|
|00002180| 6b 65 64 0d 09 57 45 4c | 69 6e 65 52 65 63 20 2a |ked..WEL|ineRec *|
|00002190| 70 4c 69 6e 65 73 3b 0d | 09 53 49 6e 74 33 32 20 |pLines;.|.SInt32 |
|000021a0| 73 74 61 72 74 4c 69 6e | 65 2c 20 65 6e 64 4c 69 |startLin|e, endLi|
|000021b0| 6e 65 3b 0d 09 53 49 6e | 74 33 32 20 6f 6c 64 54 |ne;..SIn|t32 oldT|
|000021c0| 65 78 74 48 65 69 67 68 | 74 2c 20 6e 65 77 54 65 |extHeigh|t, newTe|
|000021d0| 78 74 48 65 69 67 68 74 | 3b 0d 09 4c 6f 6e 67 52 |xtHeight|;..LongR|
|000021e0| 65 63 74 20 72 3b 0d 09 | 52 65 63 74 20 76 69 65 |ect r;..|Rect vie|
|000021f0| 77 52 65 63 74 2c 20 75 | 70 64 61 74 65 52 65 63 |wRect, u|pdateRec|
|00002200| 74 3b 0d 09 52 67 6e 48 | 61 6e 64 6c 65 20 73 61 |t;..RgnH|andle sa|
|00002210| 76 65 43 6c 69 70 2c 20 | 61 75 78 52 67 6e 3b 0d |veClip, |auxRgn;.|
|00002220| 09 47 72 61 66 50 74 72 | 20 73 61 76 65 50 6f 72 |.GrafPtr| savePor|
|00002230| 74 3b 0d 09 4f 53 45 72 | 72 20 65 72 72 3b 0d 0d |t;..OSEr|r err;..|
|00002240| 09 2f 2f 20 64 6f 20 6e | 6f 74 68 69 6e 67 20 69 |.// do n|othing i|
|00002250| 66 20 72 65 63 61 6c 63 | 75 6c 61 74 69 6f 6e 20 |f recalc|ulation |
|00002260| 68 61 73 20 62 65 65 6e | 20 69 6e 68 69 62 69 74 |has been| inhibit|
|00002270| 65 64 0d 09 69 66 20 28 | 21 42 54 53 54 28 70 57 |ed..if (|!BTST(pW|
|00002280| 45 2d 3e 66 65 61 74 75 | 72 65 73 2c 20 77 65 46 |E->featu|res, weF|
|00002290| 49 6e 68 69 62 69 74 52 | 65 63 61 6c 29 29 0d 09 |InhibitR|ecal))..|
|000022a0| 7b 0d 09 09 2f 2f 20 68 | 69 64 65 20 74 68 65 20 |{...// h|ide the |
|000022b0| 63 61 72 65 74 0d 09 09 | 69 66 20 28 42 54 53 54 |caret...|if (BTST|
|000022c0| 28 70 57 45 2d 3e 66 6c | 61 67 73 2c 20 77 65 46 |(pWE->fl|ags, weF|
|000022d0| 43 61 72 65 74 56 69 73 | 69 62 6c 65 29 29 0d 09 |CaretVis|ible))..|
|000022e0| 09 7b 0d 09 09 09 5f 57 | 45 42 6c 69 6e 6b 43 61 |.{...._W|EBlinkCa|
|000022f0| 72 65 74 28 68 57 45 29 | 3b 0d 09 09 7d 0d 0d 09 |ret(hWE)|;...}...|
|00002300| 09 2f 2f 20 72 65 6d 65 | 6d 62 65 72 20 74 6f 74 |.// reme|mber tot|
|00002310| 61 6c 20 74 65 78 74 20 | 68 65 69 67 68 74 0d 09 |al text |height..|
|00002320| 09 6f 6c 64 54 65 78 74 | 48 65 69 67 68 74 20 3d |.oldText|Height =|
|00002330| 20 70 57 45 2d 3e 64 65 | 73 74 52 65 63 74 2e 62 | pWE->de|stRect.b|
|00002340| 6f 74 74 6f 6d 20 2d 20 | 70 57 45 2d 3e 64 65 73 |ottom - |pWE->des|
|00002350| 74 52 65 63 74 2e 74 6f | 70 3b 0d 0d 09 09 2f 2f |tRect.to|p;....//|
|00002360| 20 66 69 6e 64 20 6c 69 | 6e 65 20 72 61 6e 67 65 | find li|ne range|
|00002370| 20 61 66 66 65 63 74 65 | 64 20 62 79 20 6d 6f 64 | affecte|d by mod|
|00002380| 69 66 69 63 61 74 69 6f | 6e 0d 09 09 73 74 61 72 |ificatio|n...star|
|00002390| 74 4c 69 6e 65 20 3d 20 | 57 45 4f 66 66 73 65 74 |tLine = |WEOffset|
|000023a0| 54 6f 4c 69 6e 65 28 72 | 61 6e 67 65 53 74 61 72 |ToLine(r|angeStar|
|000023b0| 74 2c 20 68 57 45 29 3b | 0d 09 09 65 6e 64 4c 69 |t, hWE);|...endLi|
|000023c0| 6e 65 20 3d 20 57 45 4f | 66 66 73 65 74 54 6f 4c |ne = WEO|ffsetToL|
|000023d0| 69 6e 65 28 72 61 6e 67 | 65 45 6e 64 2c 20 68 57 |ine(rang|eEnd, hW|
|000023e0| 45 29 3b 0d 0d 09 09 2f | 2f 20 72 65 63 61 6c 63 |E);..../|/ recalc|
|000023f0| 75 6c 61 74 65 20 6c 69 | 6e 65 20 62 72 65 61 6b |ulate li|ne break|
|00002400| 73 20 73 74 61 72 74 69 | 6e 67 20 66 72 6f 6d 20 |s starti|ng from |
|00002410| 73 74 61 72 74 4c 69 6e | 65 0d 09 09 69 66 20 28 |startLin|e...if (|
|00002420| 28 65 72 72 20 3d 20 5f | 57 45 52 65 63 61 6c 42 |(err = _|WERecalB|
|00002430| 72 65 61 6b 73 28 26 73 | 74 61 72 74 4c 69 6e 65 |reaks(&s|tartLine|
|00002440| 2c 20 26 65 6e 64 4c 69 | 6e 65 2c 20 68 57 45 29 |, &endLi|ne, hWE)|
|00002450| 29 20 21 3d 20 6e 6f 45 | 72 72 29 0d 09 09 7b 0d |) != noE|rr)...{.|
|00002460| 09 09 09 67 6f 74 6f 20 | 63 6c 65 61 6e 75 70 3b |...goto |cleanup;|
|00002470| 0d 09 09 7d 0d 0d 09 09 | 2f 2f 20 72 65 63 61 6c |...}....|// recal|
|00002480| 63 75 6c 61 74 65 20 73 | 6c 6f 70 73 0d 09 09 5f |culate s|lops..._|
|00002490| 57 45 52 65 63 61 6c 53 | 6c 6f 70 73 28 73 74 61 |WERecalS|lops(sta|
|000024a0| 72 74 4c 69 6e 65 2c 20 | 65 6e 64 4c 69 6e 65 2c |rtLine, |endLine,|
|000024b0| 20 68 57 45 29 3b 0d 0d | 09 09 2f 2f 20 64 6f 20 | hWE);..|..// do |
|000024c0| 6e 6f 74 68 69 6e 67 20 | 69 66 20 72 65 64 72 61 |nothing |if redra|
|000024d0| 77 69 6e 67 20 68 61 73 | 20 62 65 65 6e 20 69 6e |wing has| been in|
|000024e0| 68 69 62 69 74 65 64 0d | 09 09 69 66 20 28 21 42 |hibited.|..if (!B|
|000024f0| 54 53 54 28 70 57 45 2d | 3e 66 65 61 74 75 72 65 |TST(pWE-|>feature|
|00002500| 73 2c 20 77 65 46 49 6e | 68 69 62 69 74 52 65 64 |s, weFIn|hibitRed|
|00002510| 72 61 77 29 29 0d 09 09 | 7b 0d 09 09 09 2f 2f 20 |raw))...|{....// |
|00002520| 63 61 6c 63 75 6c 61 74 | 65 20 6e 65 77 20 74 6f |calculat|e new to|
|00002530| 74 61 6c 20 74 65 78 74 | 20 68 65 69 67 68 74 0d |tal text| height.|
|00002540| 09 09 09 6e 65 77 54 65 | 78 74 48 65 69 67 68 74 |...newTe|xtHeight|
|00002550| 20 3d 20 70 57 45 2d 3e | 64 65 73 74 52 65 63 74 | = pWE->|destRect|
|00002560| 2e 62 6f 74 74 6f 6d 20 | 2d 20 70 57 45 2d 3e 64 |.bottom |- pWE->d|
|00002570| 65 73 74 52 65 63 74 2e | 74 6f 70 3b 0d 0d 09 09 |estRect.|top;....|
|00002580| 09 2f 2f 20 63 61 6c 63 | 75 6c 61 74 65 20 74 68 |.// calc|ulate th|
|00002590| 65 20 72 65 63 74 61 6e | 67 6c 65 20 74 6f 20 72 |e rectan|gle to r|
|000025a0| 65 64 72 61 77 20 28 69 | 6e 20 6c 6f 6e 67 20 63 |edraw (i|n long c|
|000025b0| 6f 6f 72 64 69 6e 61 74 | 65 73 29 0d 09 09 09 72 |oordinat|es)....r|
|000025c0| 2e 6c 65 66 74 20 3d 20 | 2d 53 48 52 54 5f 4d 41 |.left = |-SHRT_MA|
|000025d0| 58 3b 0d 09 09 09 72 2e | 72 69 67 68 74 20 3d 20 |X;....r.|right = |
|000025e0| 53 48 52 54 5f 4d 41 58 | 3b 0d 09 09 09 70 4c 69 |SHRT_MAX|;....pLi|
|000025f0| 6e 65 73 20 3d 20 2a 70 | 57 45 2d 3e 68 4c 69 6e |nes = *p|WE->hLin|
|00002600| 65 73 3b 0d 09 09 09 72 | 2e 74 6f 70 20 3d 20 70 |es;....r|.top = p|
|00002610| 4c 69 6e 65 73 5b 73 74 | 61 72 74 4c 69 6e 65 5d |Lines[st|artLine]|
|00002620| 2e 6c 69 6e 65 4f 72 69 | 67 69 6e 3b 0d 0d 09 09 |.lineOri|gin;....|
|00002630| 09 2f 2f 20 69 66 20 74 | 6f 74 61 6c 20 74 65 78 |.// if t|otal tex|
|00002640| 74 20 68 65 69 67 68 74 | 20 68 61 73 6e 27 74 20 |t height| hasn't |
|00002650| 63 68 61 6e 67 65 64 2c | 20 69 74 27 73 20 65 6e |changed,| it's en|
|00002660| 6f 75 67 68 20 74 6f 20 | 72 65 64 72 61 77 20 6c |ough to |redraw l|
|00002670| 69 6e 65 73 20 75 70 20 | 74 6f 20 65 6e 64 4c 69 |ines up |to endLi|
|00002680| 6e 65 0d 09 09 09 2f 2f | 20 6f 74 68 65 72 77 69 |ne....//| otherwi|
|00002690| 73 65 20 77 65 20 6d 75 | 73 74 20 72 65 64 72 61 |se we mu|st redra|
|000026a0| 77 20 61 6c 6c 20 6c 69 | 6e 65 73 20 66 72 6f 6d |w all li|nes from|
|000026b0| 20 73 74 61 72 74 4c 69 | 6e 65 20 6f 6e 0d 09 09 | startLi|ne on...|
|000026c0| 09 69 66 20 28 28 6e 65 | 77 54 65 78 74 48 65 69 |.if ((ne|wTextHei|
|000026d0| 67 68 74 20 3d 3d 20 6f | 6c 64 54 65 78 74 48 65 |ght == o|ldTextHe|
|000026e0| 69 67 68 74 29 20 26 26 | 20 28 65 6e 64 4c 69 6e |ight) &&| (endLin|
|000026f0| 65 20 3c 20 70 57 45 2d | 3e 6e 4c 69 6e 65 73 20 |e < pWE-|>nLines |
|00002700| 2d 20 31 29 29 0d 09 09 | 09 7b 0d 09 09 09 09 72 |- 1))...|.{.....r|
|00002710| 2e 62 6f 74 74 6f 6d 20 | 3d 20 70 4c 69 6e 65 73 |.bottom |= pLines|
|00002720| 5b 65 6e 64 4c 69 6e 65 | 20 2b 20 31 5d 2e 6c 69 |[endLine| + 1].li|
|00002730| 6e 65 4f 72 69 67 69 6e | 3b 0d 09 09 09 7d 0d 09 |neOrigin|;....}..|
|00002740| 09 09 65 6c 73 65 20 69 | 66 20 28 6e 65 77 54 65 |..else i|f (newTe|
|00002750| 78 74 48 65 69 67 68 74 | 20 3c 20 6f 6c 64 54 65 |xtHeight| < oldTe|
|00002760| 78 74 48 65 69 67 68 74 | 29 0d 09 09 09 7b 0d 09 |xtHeight|)....{..|
|00002770| 09 09 09 72 2e 62 6f 74 | 74 6f 6d 20 3d 20 6f 6c |...r.bot|tom = ol|
|00002780| 64 54 65 78 74 48 65 69 | 67 68 74 3b 0d 09 09 09 |dTextHei|ght;....|
|00002790| 7d 0d 09 09 09 65 6c 73 | 65 0d 09 09 09 7b 0d 09 |}....els|e....{..|
|000027a0| 09 09 09 72 2e 62 6f 74 | 74 6f 6d 20 3d 20 6e 65 |...r.bot|tom = ne|
|000027b0| 77 54 65 78 74 48 65 69 | 67 68 74 3b 0d 09 09 09 |wTextHei|ght;....|
|000027c0| 7d 0d 0d 09 09 09 57 45 | 4f 66 66 73 65 74 4c 6f |}.....WE|OffsetLo|
|000027d0| 6e 67 52 65 63 74 28 26 | 72 2c 20 30 2c 20 70 57 |ngRect(&|r, 0, pW|
|000027e0| 45 2d 3e 64 65 73 74 52 | 65 63 74 2e 74 6f 70 29 |E->destR|ect.top)|
|000027f0| 3b 0d 0d 09 09 09 2f 2f | 20 63 61 6c 63 75 6c 61 |;.....//| calcula|
|00002800| 74 65 20 74 68 65 20 69 | 6e 74 65 72 73 65 63 74 |te the i|ntersect|
|00002810| 69 6f 6e 20 62 65 74 77 | 65 65 6e 20 74 68 69 73 |ion betw|een this|
|00002820| 20 72 65 63 74 61 6e 67 | 6c 65 20 61 6e 64 20 74 | rectang|le and t|
|00002830| 68 65 20 76 69 65 77 20 | 72 65 63 74 61 6e 67 6c |he view |rectangl|
|00002840| 65 0d 09 09 09 57 45 4c | 6f 6e 67 52 65 63 74 54 |e....WEL|ongRectT|
|00002850| 6f 52 65 63 74 28 26 72 | 2c 20 26 75 70 64 61 74 |oRect(&r|, &updat|
|00002860| 65 52 65 63 74 29 3b 0d | 09 09 09 57 45 4c 6f 6e |eRect);.|...WELon|
|00002870| 67 52 65 63 74 54 6f 52 | 65 63 74 28 26 70 57 45 |gRectToR|ect(&pWE|
|00002880| 2d 3e 76 69 65 77 52 65 | 63 74 2c 20 26 76 69 65 |->viewRe|ct, &vie|
|00002890| 77 52 65 63 74 29 3b 0d | 0d 09 09 09 69 66 20 28 |wRect);.|....if (|
|000028a0| 53 65 63 74 52 65 63 74 | 28 26 75 70 64 61 74 65 |SectRect|(&update|
|000028b0| 52 65 63 74 2c 20 26 76 | 69 65 77 52 65 63 74 2c |Rect, &v|iewRect,|
|000028c0| 20 26 75 70 64 61 74 65 | 52 65 63 74 29 29 0d 09 | &update|Rect))..|
|000028d0| 09 09 7b 0d 09 09 09 09 | 2f 2f 20 73 65 74 20 75 |..{.....|// set u|
|000028e0| 70 20 74 68 65 20 70 6f | 72 74 20 61 6e 64 20 74 |p the po|rt and t|
|000028f0| 68 65 20 63 6c 69 70 20 | 72 65 67 69 6f 6e 0d 09 |he clip |region..|
|00002900| 09 09 09 47 65 74 50 6f | 72 74 28 26 73 61 76 65 |...GetPo|rt(&save|
|00002910| 50 6f 72 74 29 3b 0d 09 | 09 09 09 53 65 74 50 6f |Port);..|...SetPo|
|00002920| 72 74 28 70 57 45 2d 3e | 70 6f 72 74 29 3b 0d 0d |rt(pWE->|port);..|
|00002930| 09 09 09 09 2f 2f 20 72 | 65 73 74 72 69 63 74 20 |....// r|estrict |
|00002940| 74 68 65 20 63 6c 69 70 | 20 72 65 67 69 6f 6e 20 |the clip| region |
|00002950| 74 6f 20 75 70 64 61 74 | 65 52 65 63 74 0d 09 09 |to updat|eRect...|
|00002960| 09 09 73 61 76 65 43 6c | 69 70 20 3d 20 4e 65 77 |..saveCl|ip = New|
|00002970| 52 67 6e 28 29 3b 0d 09 | 09 09 09 47 65 74 43 6c |Rgn();..|...GetCl|
|00002980| 69 70 28 73 61 76 65 43 | 6c 69 70 29 3b 0d 09 09 |ip(saveC|lip);...|
|00002990| 09 09 61 75 78 52 67 6e | 20 3d 20 4e 65 77 52 67 |..auxRgn| = NewRg|
|000029a0| 6e 28 29 3b 0d 09 09 09 | 09 52 65 63 74 52 67 6e |n();....|.RectRgn|
|000029b0| 28 61 75 78 52 67 6e 2c | 20 26 75 70 64 61 74 65 |(auxRgn,| &update|
|000029c0| 52 65 63 74 29 3b 0d 09 | 09 09 09 53 65 63 74 52 |Rect);..|...SectR|
|000029d0| 67 6e 28 73 61 76 65 43 | 6c 69 70 2c 20 61 75 78 |gn(saveC|lip, aux|
|000029e0| 52 67 6e 2c 20 61 75 78 | 52 67 6e 29 3b 0d 09 09 |Rgn, aux|Rgn);...|
|000029f0| 09 09 53 65 74 43 6c 69 | 70 28 61 75 78 52 67 6e |..SetCli|p(auxRgn|
|00002a00| 29 3b 0d 09 09 09 09 44 | 69 73 70 6f 73 65 52 67 |);.....D|isposeRg|
|00002a10| 6e 28 61 75 78 52 67 6e | 29 3b 0d 0d 09 09 09 09 |n(auxRgn|);......|
|00002a20| 2f 2f 20 77 65 20 6f 6e | 6c 79 20 72 65 61 6c 6c |// we on|ly reall|
|00002a30| 79 20 6e 65 65 64 20 74 | 6f 20 72 65 64 72 61 77 |y need t|o redraw|
|00002a40| 20 74 68 65 20 76 69 73 | 69 62 6c 65 20 6c 69 6e | the vis|ible lin|
|00002a50| 65 73 0d 09 09 09 09 73 | 74 61 72 74 4c 69 6e 65 |es.....s|tartLine|
|00002a60| 20 3d 20 5f 57 45 50 69 | 78 65 6c 54 6f 4c 69 6e | = _WEPi|xelToLin|
|00002a70| 65 28 75 70 64 61 74 65 | 52 65 63 74 2e 74 6f 70 |e(update|Rect.top|
|00002a80| 20 2d 20 70 57 45 2d 3e | 64 65 73 74 52 65 63 74 | - pWE->|destRect|
|00002a90| 2e 74 6f 70 2c 20 68 57 | 45 29 3b 0d 09 09 09 09 |.top, hW|E);.....|
|00002aa0| 65 6e 64 4c 69 6e 65 20 | 3d 20 5f 57 45 50 69 78 |endLine |= _WEPix|
|00002ab0| 65 6c 54 6f 4c 69 6e 65 | 28 75 70 64 61 74 65 52 |elToLine|(updateR|
|00002ac0| 65 63 74 2e 62 6f 74 74 | 6f 6d 20 2d 20 70 57 45 |ect.bott|om - pWE|
|00002ad0| 2d 3e 64 65 73 74 52 65 | 63 74 2e 74 6f 70 20 2d |->destRe|ct.top -|
|00002ae0| 20 31 2c 20 68 57 45 29 | 3b 0d 0d 09 09 09 09 2f | 1, hWE)|;....../|
|00002af0| 2f 20 72 65 64 72 61 77 | 20 74 68 65 20 6c 69 6e |/ redraw| the lin|
|00002b00| 65 73 20 28 70 61 73 73 | 20 74 72 75 65 20 69 6e |es (pass| true in|
|00002b10| 20 74 68 65 20 64 6f 45 | 72 61 73 65 20 70 61 72 | the doE|rase par|
|00002b20| 61 6d 65 74 65 72 29 0d | 09 09 09 09 5f 57 45 44 |ameter).|...._WED|
|00002b30| 72 61 77 4c 69 6e 65 73 | 28 73 74 61 72 74 4c 69 |rawLines|(startLi|
|00002b40| 6e 65 2c 20 65 6e 64 4c | 69 6e 65 2c 20 74 72 75 |ne, endL|ine, tru|
|00002b50| 65 2c 20 68 57 45 29 3b | 0d 0d 09 09 09 09 2f 2f |e, hWE);|......//|
|00002b60| 20 65 72 61 73 65 20 74 | 68 65 20 70 6f 72 74 69 | erase t|he porti|
|00002b70| 6f 6e 20 6f 66 20 74 68 | 65 20 75 70 64 61 74 65 |on of th|e update|
|00002b80| 20 72 65 63 74 61 6e 67 | 6c 65 20 62 65 6c 6f 77 | rectang|le below|
|00002b90| 20 74 68 65 20 6c 61 73 | 74 20 6c 69 6e 65 20 28 | the las|t line (|
|00002ba0| 69 66 20 61 6e 79 29 0d | 09 09 09 09 70 4c 69 6e |if any).|....pLin|
|00002bb0| 65 73 20 3d 20 2a 70 57 | 45 2d 3e 68 4c 69 6e 65 |es = *pW|E->hLine|
|00002bc0| 73 3b 0d 09 09 09 09 75 | 70 64 61 74 65 52 65 63 |s;.....u|pdateRec|
|00002bd0| 74 2e 74 6f 70 20 3d 20 | 70 57 45 2d 3e 64 65 73 |t.top = |pWE->des|
|00002be0| 74 52 65 63 74 2e 74 6f | 70 20 2b 20 70 4c 69 6e |tRect.to|p + pLin|
|00002bf0| 65 73 5b 65 6e 64 4c 69 | 6e 65 20 2b 20 31 5d 2e |es[endLi|ne + 1].|
|00002c00| 6c 69 6e 65 4f 72 69 67 | 69 6e 3b 0d 09 09 09 09 |lineOrig|in;.....|
|00002c10| 69 66 20 28 75 70 64 61 | 74 65 52 65 63 74 2e 74 |if (upda|teRect.t|
|00002c20| 6f 70 20 3c 20 75 70 64 | 61 74 65 52 65 63 74 2e |op < upd|ateRect.|
|00002c30| 62 6f 74 74 6f 6d 29 0d | 09 09 09 09 7b 0d 09 09 |bottom).|....{...|
|00002c40| 09 09 09 43 61 6c 6c 57 | 45 45 72 61 73 65 50 72 |...CallW|EErasePr|
|00002c50| 6f 63 28 26 75 70 64 61 | 74 65 52 65 63 74 2c 20 |oc(&upda|teRect, |
|00002c60| 68 57 45 2c 20 70 57 45 | 2d 3e 65 72 61 73 65 48 |hWE, pWE|->eraseH|
|00002c70| 6f 6f 6b 29 3b 0d 09 09 | 09 09 7d 0d 0d 09 09 09 |ook);...|..}.....|
|00002c80| 09 2f 2f 20 72 65 73 74 | 6f 72 65 20 74 68 65 20 |.// rest|ore the |
|00002c90| 63 6c 69 70 20 72 65 67 | 69 6f 6e 0d 09 09 09 09 |clip reg|ion.....|
|00002ca0| 53 65 74 43 6c 69 70 28 | 73 61 76 65 43 6c 69 70 |SetClip(|saveClip|
|00002cb0| 29 3b 0d 09 09 09 09 44 | 69 73 70 6f 73 65 52 67 |);.....D|isposeRg|
|00002cc0| 6e 28 73 61 76 65 43 6c | 69 70 29 3b 0d 0d 09 09 |n(saveCl|ip);....|
|00002cd0| 09 09 2f 2f 20 72 65 73 | 74 6f 72 65 20 74 68 65 |..// res|tore the|
|00002ce0| 20 70 6f 72 74 0d 09 09 | 09 09 53 65 74 50 6f 72 | port...|..SetPor|
|00002cf0| 74 28 73 61 76 65 50 6f | 72 74 29 3b 0d 0d 09 09 |t(savePo|rt);....|
|00002d00| 09 09 2f 2f 20 72 65 64 | 72 61 77 20 74 68 65 20 |..// red|raw the |
|00002d10| 63 61 72 65 74 20 6f 72 | 20 74 68 65 20 73 65 6c |caret or| the sel|
|00002d20| 65 63 74 69 6f 6e 20 72 | 61 6e 67 65 0d 09 09 09 |ection r|ange....|
|00002d30| 09 69 66 20 28 70 57 45 | 2d 3e 73 65 6c 53 74 61 |.if (pWE|->selSta|
|00002d40| 72 74 20 3c 20 70 57 45 | 2d 3e 73 65 6c 45 6e 64 |rt < pWE|->selEnd|
|00002d50| 29 0d 09 09 09 09 7b 0d | 09 09 09 09 09 5f 57 45 |).....{.|....._WE|
|00002d60| 48 69 6c 69 74 65 52 61 | 6e 67 65 28 70 57 45 2d |HiliteRa|nge(pWE-|
|00002d70| 3e 73 65 6c 53 74 61 72 | 74 2c 20 70 57 45 2d 3e |>selStar|t, pWE->|
|00002d80| 73 65 6c 45 6e 64 2c 20 | 68 57 45 29 3b 0d 09 09 |selEnd, |hWE);...|
|00002d90| 09 09 7d 0d 09 09 09 09 | 65 6c 73 65 0d 09 09 09 |..}.....|else....|
|00002da0| 09 7b 0d 09 09 09 09 09 | 5f 57 45 42 6c 69 6e 6b |.{......|_WEBlink|
|00002db0| 43 61 72 65 74 28 68 57 | 45 29 3b 0d 09 09 09 09 |Caret(hW|E);.....|
|00002dc0| 7d 0d 09 09 09 7d 20 2f | 2f 20 69 66 20 53 65 63 |}....} /|/ if Sec|
|00002dd0| 74 52 65 63 74 0d 0d 09 | 09 09 2f 2f 20 73 63 72 |tRect...|..// scr|
|00002de0| 6f 6c 6c 20 74 68 65 20 | 73 65 6c 65 63 74 69 6f |oll the |selectio|
|00002df0| 6e 20 72 61 6e 67 65 20 | 69 6e 74 6f 20 76 69 65 |n range |into vie|
|00002e00| 77 0d 09 09 09 57 45 53 | 65 6c 56 69 65 77 28 68 |w....WES|elView(h|
|00002e10| 57 45 29 3b 0d 0d 09 09 | 7d 20 2f 2f 20 69 66 20 |WE);....|} // if |
|00002e20| 72 65 64 72 61 77 20 6e | 6f 74 20 69 6e 68 69 62 |redraw n|ot inhib|
|00002e30| 69 74 65 64 0d 09 7d 20 | 2f 2f 20 69 66 20 72 65 |ited..} |// if re|
|00002e40| 63 61 6c 20 6e 6f 74 20 | 69 6e 68 69 62 69 74 65 |cal not |inhibite|
|00002e50| 64 0d 0d 09 2f 2f 20 63 | 6c 65 61 72 20 72 65 73 |d...// c|lear res|
|00002e60| 75 6c 74 20 63 6f 64 65 | 0d 09 65 72 72 20 3d 20 |ult code|..err = |
|00002e70| 6e 6f 45 72 72 3b 0d 0d | 63 6c 65 61 6e 75 70 3a |noErr;..|cleanup:|
|00002e80| 0d 09 2f 2f 20 72 65 74 | 75 72 6e 20 72 65 73 75 |..// ret|urn resu|
|00002e90| 6c 74 20 63 6f 64 65 0d | 09 72 65 74 75 72 6e 20 |lt code.|.return |
|00002ea0| 65 72 72 3b 0d 7d 0d 0d | 70 61 73 63 61 6c 20 4f |err;.}..|pascal O|
|00002eb0| 53 45 72 72 20 57 45 43 | 61 6c 54 65 78 74 28 57 |SErr WEC|alText(W|
|00002ec0| 45 48 61 6e 64 6c 65 20 | 68 57 45 29 0d 7b 0d 09 |EHandle |hWE).{..|
|00002ed0| 42 6f 6f 6c 65 61 6e 20 | 73 61 76 65 57 45 4c 6f |Boolean |saveWELo|
|00002ee0| 63 6b 3b 0d 09 4f 53 45 | 72 72 20 65 72 72 3b 0d |ck;..OSE|rr err;.|
|00002ef0| 0d 09 2f 2f 20 6c 6f 63 | 6b 20 57 45 20 72 65 63 |..// loc|k WE rec|
|00002f00| 6f 72 64 0d 09 73 61 76 | 65 57 45 4c 6f 63 6b 20 |ord..sav|eWELock |
|00002f10| 3d 20 5f 57 45 53 65 74 | 48 61 6e 64 6c 65 4c 6f |= _WESet|HandleLo|
|00002f20| 63 6b 28 28 48 61 6e 64 | 6c 65 29 20 68 57 45 2c |ck((Hand|le) hWE,|
|00002f30| 20 74 72 75 65 29 3b 0d | 0d 23 69 66 20 57 41 53 | true);.|.#if WAS|
|00002f40| 54 45 5f 57 45 43 41 4c | 54 45 58 54 5f 44 4f 45 |TE_WECAL|TEXT_DOE|
|00002f50| 53 5f 52 45 44 52 41 57 | 0d 0d 09 2f 2f 20 72 65 |S_REDRAW|...// re|
|00002f60| 63 61 6c 63 75 6c 61 74 | 65 20 6c 69 6e 65 20 62 |calculat|e line b|
|00002f70| 72 65 61 6b 73 20 26 20 | 73 6c 6f 70 73 20 61 6e |reaks & |slops an|
|00002f80| 64 20 72 65 64 72 61 77 | 20 74 68 65 20 74 65 78 |d redraw| the tex|
|00002f90| 74 0d 09 65 72 72 20 3d | 20 5f 57 45 52 65 64 72 |t..err =| _WERedr|
|00002fa0| 61 77 28 30 2c 20 4c 4f | 4e 47 5f 4d 41 58 2c 20 |aw(0, LO|NG_MAX, |
|00002fb0| 68 57 45 29 3b 0d 0d 23 | 65 6c 73 65 0d 0d 09 7b |hWE);..#|else...{|
|00002fc0| 0d 09 09 53 49 6e 74 33 | 32 20 73 74 61 72 74 4c |...SInt3|2 startL|
|00002fd0| 69 6e 65 20 3d 20 30 3b | 0d 09 09 53 49 6e 74 33 |ine = 0;|...SInt3|
|00002fe0| 32 20 65 6e 64 4c 69 6e | 65 20 3d 20 4c 4f 4e 47 |2 endLin|e = LONG|
|00002ff0| 5f 4d 41 58 3b 0d 0d 09 | 09 2f 2f 20 72 65 63 61 |_MAX;...|.// reca|
|00003000| 6c 63 75 6c 61 74 65 20 | 6c 69 6e 65 20 62 72 65 |lculate |line bre|
|00003010| 61 6b 73 20 26 20 73 6c | 6f 70 73 20 77 69 74 68 |aks & sl|ops with|
|00003020| 6f 75 74 20 72 65 64 72 | 61 77 69 6e 67 20 61 6e |out redr|awing an|
|00003030| 79 74 68 69 6e 67 0d 09 | 09 69 66 20 28 28 65 72 |ything..|.if ((er|
|00003040| 72 20 3d 20 5f 57 45 52 | 65 63 61 6c 42 72 65 61 |r = _WER|ecalBrea|
|00003050| 6b 73 28 26 73 74 61 72 | 74 4c 69 6e 65 2c 20 26 |ks(&star|tLine, &|
|00003060| 65 6e 64 4c 69 6e 65 2c | 20 68 57 45 29 29 20 3d |endLine,| hWE)) =|
|00003070| 3d 20 6e 6f 45 72 72 29 | 0d 09 09 7b 0d 09 09 09 |= noErr)|...{....|
|00003080| 5f 57 45 52 65 63 61 6c | 53 6c 6f 70 73 28 73 74 |_WERecal|Slops(st|
|00003090| 61 72 74 4c 69 6e 65 2c | 20 65 6e 64 4c 69 6e 65 |artLine,| endLine|
|000030a0| 2c 20 68 57 45 29 3b 0d | 09 09 7d 0d 09 7d 0d 0d |, hWE);.|..}..}..|
|000030b0| 23 65 6e 64 69 66 0d 0d | 09 2f 2f 20 75 6e 6c 6f |#endif..|.// unlo|
|000030c0| 63 6b 20 74 68 65 20 57 | 45 20 72 65 63 6f 72 64 |ck the W|E record|
|000030d0| 0d 09 5f 57 45 53 65 74 | 48 61 6e 64 6c 65 4c 6f |.._WESet|HandleLo|
|000030e0| 63 6b 28 28 48 61 6e 64 | 6c 65 29 20 68 57 45 2c |ck((Hand|le) hWE,|
|000030f0| 20 73 61 76 65 57 45 4c | 6f 63 6b 29 3b 0d 0d 09 | saveWEL|ock);...|
|00003100| 2f 2f 20 72 65 74 75 72 | 6e 20 72 65 73 75 6c 74 |// retur|n result|
|00003110| 20 63 6f 64 65 0d 09 72 | 65 74 75 72 6e 20 65 72 | code..r|eturn er|
|00003120| 72 3b 0d 7d 0d 0d 70 61 | 73 63 61 6c 20 4f 53 45 |r;.}..pa|scal OSE|
|00003130| 72 72 20 5f 57 45 53 65 | 74 53 74 79 6c 65 52 61 |rr _WESe|tStyleRa|
|00003140| 6e 67 65 28 53 49 6e 74 | 33 32 20 72 61 6e 67 65 |nge(SInt|32 range|
|00003150| 53 74 61 72 74 2c 20 53 | 49 6e 74 33 32 20 72 61 |Start, S|Int32 ra|
|00003160| 6e 67 65 45 6e 64 2c 20 | 57 45 53 74 79 6c 65 4d |ngeEnd, |WEStyleM|
|00003170| 6f 64 65 20 6d 6f 64 65 | 2c 20 63 6f 6e 73 74 20 |ode mode|, const |
|00003180| 57 45 54 65 78 74 53 74 | 79 6c 65 20 2a 74 73 2c |WETextSt|yle *ts,|
|00003190| 20 57 45 48 61 6e 64 6c | 65 20 68 57 45 29 0d 7b | WEHandl|e hWE).{|
|000031a0| 0d 09 2f 2f 20 61 6c 74 | 65 72 20 74 68 65 20 73 |..// alt|er the s|
|000031b0| 74 79 6c 65 20 61 74 74 | 72 69 62 75 74 65 73 20 |tyle att|ributes |
|000031c0| 6f 66 20 74 68 65 20 73 | 70 65 63 69 66 69 65 64 |of the s|pecified|
|000031d0| 20 74 65 78 74 20 72 61 | 6e 67 65 20 61 63 63 6f | text ra|nge acco|
|000031e0| 72 64 69 6e 67 20 74 6f | 20 74 73 20 61 6e 64 20 |rding to| ts and |
|000031f0| 6d 6f 64 65 0d 0d 09 57 | 45 50 74 72 20 70 57 45 |mode...W|EPtr pWE|
|00003200| 20 3d 20 2a 68 57 45 3b | 09 09 09 09 09 2f 2f 20 | = *hWE;|.....// |
|00003210| 61 73 73 75 6d 65 20 57 | 45 20 72 65 63 6f 72 64 |assume W|E record|
|00003220| 20 69 73 20 61 6c 72 65 | 61 64 79 20 6c 6f 63 6b | is alre|ady lock|
|00003230| 65 64 0d 09 57 45 52 75 | 6e 41 72 72 61 79 48 61 |ed..WERu|nArrayHa|
|00003240| 6e 64 6c 65 20 68 52 75 | 6e 73 20 3d 20 70 57 45 |ndle hRu|ns = pWE|
|00003250| 2d 3e 68 52 75 6e 73 3b | 0d 09 53 49 6e 74 33 32 |->hRuns;|..SInt32|
|00003260| 20 6f 66 66 73 65 74 3b | 0d 09 53 49 6e 74 33 32 | offset;|..SInt32|
|00003270| 20 72 75 6e 49 6e 64 65 | 78 3b 0d 09 53 49 6e 74 | runInde|x;..SInt|
|00003280| 33 32 20 6f 6c 64 53 74 | 79 6c 65 49 6e 64 65 78 |32 oldSt|yleIndex|
|00003290| 2c 20 6e 65 77 53 74 79 | 6c 65 49 6e 64 65 78 3b |, newSty|leIndex;|
|000032a0| 0d 09 57 45 52 75 6e 49 | 6e 66 6f 50 72 69 76 20 |..WERunI|nfoPriv |
|000032b0| 72 75 6e 49 6e 66 6f 3b | 0d 09 53 74 79 6c 65 20 |runInfo;|..Style |
|000032c0| 63 6f 6e 74 69 6e 75 6f | 75 73 53 74 79 6c 65 73 |continuo|usStyles|
|000032d0| 3b 0d 09 4f 53 45 72 72 | 20 65 72 72 3b 0d 0d 20 |;..OSErr| err;.. |
|000032e0| 20 20 20 57 45 41 53 53 | 45 52 54 28 28 28 72 61 | WEASS|ERT(((ra|
|000032f0| 6e 67 65 53 74 61 72 74 | 20 3c 20 72 61 6e 67 65 |ngeStart| < range|
|00003300| 45 6e 64 29 20 7c 7c 20 | 28 28 72 61 6e 67 65 53 |End) || |((rangeS|
|00003310| 74 61 72 74 20 3d 3d 20 | 30 29 20 26 26 20 28 72 |tart == |0) && (r|
|00003320| 61 6e 67 65 45 6e 64 20 | 3d 3d 20 30 29 20 26 26 |angeEnd |== 0) &&|
|00003330| 20 28 70 57 45 2d 3e 74 | 65 78 74 4c 65 6e 67 74 | (pWE->t|extLengt|
|00003340| 68 20 3d 3d 20 30 29 29 | 29 2c 20 22 5c 70 42 61 |h == 0))|), "\pBa|
|00003350| 64 20 73 74 79 6c 65 20 | 72 61 6e 67 65 22 29 3b |d style |range");|
|00003360| 0d 0d 09 2f 2f 20 69 66 | 20 6d 6f 64 65 20 63 6f |...// if| mode co|
|00003370| 6e 74 61 69 6e 73 20 77 | 65 44 6f 54 6f 67 67 6c |ntains w|eDoToggl|
|00003380| 65 46 61 63 65 2c 20 77 | 65 20 6e 65 65 64 20 74 |eFace, w|e need t|
|00003390| 6f 20 64 65 74 65 72 6d | 69 6e 65 20 77 68 69 63 |o determ|ine whic|
|000033a0| 68 20 51 75 69 63 6b 64 | 72 61 77 20 73 74 79 6c |h Quickd|raw styl|
|000033b0| 65 73 0d 09 2f 2f 20 61 | 72 65 20 63 6f 6e 74 69 |es..// a|re conti|
|000033c0| 6e 75 6f 75 73 20 6f 76 | 65 72 20 74 68 65 20 73 |nuous ov|er the s|
|000033d0| 70 65 63 69 66 69 65 64 | 20 74 65 78 74 20 72 61 |pecified| text ra|
|000033e0| 6e 67 65 3a 20 74 68 6f | 73 65 20 73 74 79 6c 65 |nge: tho|se style|
|000033f0| 73 20 6d 75 73 74 20 62 | 65 20 74 75 72 6e 65 64 |s must b|e turned|
|00003400| 20 6f 66 66 0d 09 69 66 | 20 28 6d 6f 64 65 20 26 | off..if| (mode &|
|00003410| 20 77 65 44 6f 54 6f 67 | 67 6c 65 46 61 63 65 29 | weDoTog|gleFace)|
|00003420| 0d 09 7b 0d 09 09 57 45 | 53 74 79 6c 65 4d 6f 64 |..{...WE|StyleMod|
|00003430| 65 20 74 65 6d 70 20 3d | 20 77 65 44 6f 46 61 63 |e temp =| weDoFac|
|00003440| 65 3b 0d 09 09 5f 57 45 | 43 6f 6e 74 69 6e 75 6f |e;..._WE|Continuo|
|00003450| 75 73 53 74 79 6c 65 52 | 61 6e 67 65 28 72 61 6e |usStyleR|ange(ran|
|00003460| 67 65 53 74 61 72 74 2c | 20 72 61 6e 67 65 45 6e |geStart,| rangeEn|
|00003470| 64 2c 20 26 74 65 6d 70 | 2c 20 26 72 75 6e 49 6e |d, &temp|, &runIn|
|00003480| 66 6f 2e 72 75 6e 41 74 | 74 72 73 2e 72 75 6e 53 |fo.runAt|trs.runS|
|00003490| 74 79 6c 65 2c 20 68 57 | 45 29 3b 0d 09 09 63 6f |tyle, hW|E);...co|
|000034a0| 6e 74 69 6e 75 6f 75 73 | 53 74 79 6c 65 73 20 3d |ntinuous|Styles =|
|000034b0| 20 72 75 6e 49 6e 66 6f | 2e 72 75 6e 41 74 74 72 | runInfo|.runAttr|
|000034c0| 73 2e 72 75 6e 53 74 79 | 6c 65 2e 74 73 46 61 63 |s.runSty|le.tsFac|
|000034d0| 65 3b 0d 09 7d 0d 09 65 | 6c 73 65 0d 09 7b 0d 09 |e;..}..e|lse..{..|
|000034e0| 09 63 6f 6e 74 69 6e 75 | 6f 75 73 53 74 79 6c 65 |.continu|ousStyle|
|000034f0| 73 20 3d 20 6e 6f 72 6d | 61 6c 3b 0d 09 7d 0d 0d |s = norm|al;..}..|
|00003500| 09 2f 2f 20 66 69 6e 64 | 20 74 68 65 20 69 6e 64 |.// find| the ind|
|00003510| 65 78 20 74 6f 20 74 68 | 65 20 66 69 72 73 74 20 |ex to th|e first |
|00003520| 73 74 79 6c 65 20 72 75 | 6e 20 69 6e 20 74 68 65 |style ru|n in the|
|00003530| 20 73 70 65 63 69 66 69 | 65 64 20 72 61 6e 67 65 | specifi|ed range|
|00003540| 0d 09 6f 66 66 73 65 74 | 20 3d 20 72 61 6e 67 65 |..offset| = range|
|00003550| 53 74 61 72 74 3b 0d 09 | 72 75 6e 49 6e 64 65 78 |Start;..|runIndex|
|00003560| 20 3d 20 57 45 4f 66 66 | 73 65 74 54 6f 52 75 6e | = WEOff|setToRun|
|00003570| 28 6f 66 66 73 65 74 2c | 20 68 57 45 29 3b 0d 0d |(offset,| hWE);..|
|00003580| 09 2f 2f 20 72 75 6e 20 | 74 68 72 75 20 61 6c 6c |.// run |thru all|
|00003590| 20 74 68 65 20 73 74 79 | 6c 65 20 72 75 6e 73 20 | the sty|le runs |
|000035a0| 74 68 61 74 20 65 6e 63 | 6f 6d 70 61 73 73 20 74 |that enc|ompass t|
|000035b0| 68 65 20 73 65 6c 65 63 | 74 69 6f 6e 20 72 61 6e |he selec|tion ran|
|000035c0| 67 65 0d 09 64 6f 0d 09 | 7b 0d 09 09 2f 2f 20 66 |ge..do..|{...// f|
|000035d0| 69 6e 64 20 73 74 79 6c | 65 20 69 6e 64 65 78 20 |ind styl|e index |
|000035e0| 66 6f 72 20 74 68 69 73 | 20 72 75 6e 20 61 6e 64 |for this| run and|
|000035f0| 20 72 65 74 72 69 65 76 | 65 20 63 6f 72 72 65 73 | retriev|e corres|
|00003600| 70 6f 6e 64 69 6e 67 20 | 73 74 79 6c 65 20 61 74 |ponding |style at|
|00003610| 74 72 69 62 75 74 65 73 | 0d 09 09 6f 6c 64 53 74 |tributes|...oldSt|
|00003620| 79 6c 65 49 6e 64 65 78 | 20 3d 20 28 2a 68 52 75 |yleIndex| = (*hRu|
|00003630| 6e 73 29 5b 72 75 6e 49 | 6e 64 65 78 5d 2e 73 74 |ns)[runI|ndex].st|
|00003640| 79 6c 65 49 6e 64 65 78 | 3b 0d 09 09 5f 57 45 47 |yleIndex|;..._WEG|
|00003650| 65 74 49 6e 64 53 74 79 | 6c 65 28 72 75 6e 49 6e |etIndSty|le(runIn|
|00003660| 64 65 78 2c 20 26 72 75 | 6e 49 6e 66 6f 2c 20 68 |dex, &ru|nInfo, h|
|00003670| 57 45 29 3b 0d 0d 09 09 | 2f 2f 20 5f 57 45 47 65 |WE);....|// _WEGe|
|00003680| 74 49 6e 64 53 74 79 6c | 65 20 72 65 74 75 72 6e |tIndStyl|e return|
|00003690| 73 20 74 65 78 74 4c 65 | 6e 67 74 68 20 2b 20 31 |s textLe|ngth + 1|
|000036a0| 20 69 6e 20 72 75 6e 49 | 6e 66 6f 2e 72 75 6e 45 | in runI|nfo.runE|
|000036b0| 6e 64 20 66 6f 72 20 74 | 68 65 20 6c 61 73 74 20 |nd for t|he last |
|000036c0| 73 74 79 6c 65 20 72 75 | 6e 3a 0d 09 09 2f 2f 20 |style ru|n:...// |
|000036d0| 63 6f 72 72 65 63 74 20 | 74 68 69 73 20 61 6e 6f |correct |this ano|
|000036e0| 6d 61 6c 79 20 28 77 68 | 69 63 68 20 69 73 20 75 |maly (wh|ich is u|
|000036f0| 73 65 66 75 6c 20 66 6f | 72 20 6f 74 68 65 72 20 |seful fo|r other |
|00003700| 70 75 72 70 6f 73 65 73 | 2c 20 61 6e 79 77 61 79 |purposes|, anyway|
|00003710| 29 0d 09 09 69 66 20 28 | 72 75 6e 49 6e 66 6f 2e |)...if (|runInfo.|
|00003720| 72 75 6e 45 6e 64 20 3e | 20 70 57 45 2d 3e 74 65 |runEnd >| pWE->te|
|00003730| 78 74 4c 65 6e 67 74 68 | 29 0d 09 09 7b 0d 09 09 |xtLength|)...{...|
|00003740| 09 72 75 6e 49 6e 66 6f | 2e 72 75 6e 45 6e 64 20 |.runInfo|.runEnd |
|00003750| 3d 20 70 57 45 2d 3e 74 | 65 78 74 4c 65 6e 67 74 |= pWE->t|extLengt|
|00003760| 68 3b 0d 09 09 7d 0d 0d | 09 09 2f 2f 20 61 70 70 |h;...}..|..// app|
|00003770| 6c 79 20 63 68 61 6e 67 | 65 73 20 74 6f 20 65 78 |ly chang|es to ex|
|00003780| 69 73 74 69 6e 67 20 73 | 74 79 6c 65 20 61 74 74 |isting s|tyle att|
|00003790| 72 69 62 75 74 65 73 20 | 61 73 20 72 65 71 75 65 |ributes |as reque|
|000037a0| 73 74 65 64 0d 09 09 5f | 57 45 43 6f 70 79 53 74 |sted..._|WECopySt|
|000037b0| 79 6c 65 28 74 73 2c 20 | 26 72 75 6e 49 6e 66 6f |yle(ts, |&runInfo|
|000037c0| 2e 72 75 6e 41 74 74 72 | 73 2e 72 75 6e 53 74 79 |.runAttr|s.runSty|
|000037d0| 6c 65 2c 20 63 6f 6e 74 | 69 6e 75 6f 75 73 53 74 |le, cont|inuousSt|
|000037e0| 79 6c 65 73 2c 20 6d 6f | 64 65 29 3b 0d 0d 09 09 |yles, mo|de);....|
|000037f0| 2f 2f 20 74 68 65 20 68 | 69 67 68 20 62 69 74 20 |// the h|igh bit |
|00003800| 6f 66 20 74 73 46 6c 61 | 67 73 20 6d 75 73 74 20 |of tsFla|gs must |
|00003810| 62 65 20 73 65 74 20 69 | 66 20 74 68 65 20 66 6f |be set i|f the fo|
|00003820| 6e 74 0d 09 09 2f 2f 20 | 62 65 6c 6f 6e 67 73 20 |nt...// |belongs |
|00003830| 74 6f 20 61 20 72 69 67 | 68 74 2d 74 6f 2d 6c 65 |to a rig|ht-to-le|
|00003840| 66 74 20 73 63 72 69 70 | 74 20 73 79 73 74 65 6d |ft scrip|t system|
|00003850| 0d 09 09 69 66 20 28 42 | 54 53 54 28 70 57 45 2d |...if (B|TST(pWE-|
|00003860| 3e 66 6c 61 67 73 2c 20 | 77 65 46 42 69 64 69 72 |>flags, |weFBidir|
|00003870| 65 63 74 69 6f 6e 61 6c | 29 29 0d 09 09 7b 0d 09 |ectional|))...{..|
|00003880| 09 09 69 66 20 28 47 65 | 74 53 63 72 69 70 74 56 |..if (Ge|tScriptV|
|00003890| 61 72 69 61 62 6c 65 28 | 46 6f 6e 74 54 6f 53 63 |ariable(|FontToSc|
|000038a0| 72 69 70 74 28 72 75 6e | 49 6e 66 6f 2e 72 75 6e |ript(run|Info.run|
|000038b0| 41 74 74 72 73 2e 72 75 | 6e 53 74 79 6c 65 2e 74 |Attrs.ru|nStyle.t|
|000038c0| 73 46 6f 6e 74 29 2c 20 | 73 6d 53 63 72 69 70 74 |sFont), |smScript|
|000038d0| 52 69 67 68 74 29 20 21 | 3d 20 30 29 0d 09 09 09 |Right) !|= 0)....|
|000038e0| 7b 0d 09 09 09 09 42 53 | 45 54 28 72 75 6e 49 6e |{.....BS|ET(runIn|
|000038f0| 66 6f 2e 72 75 6e 41 74 | 74 72 73 2e 72 75 6e 53 |fo.runAt|trs.runS|
|00003900| 74 79 6c 65 2e 74 73 46 | 6c 61 67 73 2c 20 74 73 |tyle.tsF|lags, ts|
|00003910| 52 69 67 68 74 54 6f 4c | 65 66 74 29 3b 0d 09 09 |RightToL|eft);...|
|00003920| 09 7d 0d 09 09 7d 0d 0d | 09 09 2f 2f 20 67 65 74 |.}...}..|..// get|
|00003930| 20 61 20 73 74 79 6c 65 | 20 69 6e 64 65 78 20 66 | a style| index f|
|00003940| 6f 72 20 74 68 65 20 6e | 65 77 20 74 65 78 74 20 |or the n|ew text |
|00003950| 73 74 79 6c 65 0d 09 09 | 69 66 20 28 28 65 72 72 |style...|if ((err|
|00003960| 20 3d 20 5f 57 45 4e 65 | 77 53 74 79 6c 65 28 26 | = _WENe|wStyle(&|
|00003970| 72 75 6e 49 6e 66 6f 2e | 72 75 6e 41 74 74 72 73 |runInfo.|runAttrs|
|00003980| 2e 72 75 6e 53 74 79 6c | 65 2c 20 26 6e 65 77 53 |.runStyl|e, &newS|
|00003990| 74 79 6c 65 49 6e 64 65 | 78 2c 20 70 57 45 29 29 |tyleInde|x, pWE))|
|000039a0| 20 21 3d 20 6e 6f 45 72 | 72 29 0d 09 09 7b 0d 09 | != noEr|r)...{..|
|000039b0| 09 09 67 6f 74 6f 20 63 | 6c 65 61 6e 75 70 3b 0d |..goto c|leanup;.|
|000039c0| 09 09 7d 0d 0d 09 09 2f | 2f 20 69 66 20 6f 66 66 |..}..../|/ if off|
|000039d0| 73 65 74 20 66 61 6c 6c | 73 20 6f 6e 20 61 20 73 |set fall|s on a s|
|000039e0| 74 79 6c 65 20 62 6f 75 | 6e 64 61 72 79 20 61 6e |tyle bou|ndary an|
|000039f0| 64 20 74 68 69 73 20 73 | 74 79 6c 65 20 72 75 6e |d this s|tyle run|
|00003a00| 20 68 61 73 20 62 65 63 | 6f 6d 65 20 69 64 65 6e | has bec|ome iden|
|00003a10| 74 69 63 61 6c 0d 09 09 | 2f 2f 20 74 6f 20 74 68 |tical...|// to th|
|00003a20| 65 20 70 72 65 76 69 6f | 75 73 20 6f 6e 65 2c 20 |e previo|us one, |
|00003a30| 6d 65 72 67 65 20 74 68 | 65 20 74 77 6f 20 72 75 |merge th|e two ru|
|00003a40| 6e 73 20 74 6f 67 65 74 | 68 65 72 0d 09 09 69 66 |ns toget|her...if|
|00003a50| 20 28 28 6f 66 66 73 65 | 74 20 3d 3d 20 72 75 6e | ((offse|t == run|
|00003a60| 49 6e 66 6f 2e 72 75 6e | 53 74 61 72 74 29 20 26 |Info.run|Start) &|
|00003a70| 26 20 28 72 75 6e 49 6e | 64 65 78 20 3e 20 30 29 |& (runIn|dex > 0)|
|00003a80| 20 26 26 0d 09 09 09 28 | 28 2a 68 52 75 6e 73 29 | &&....(|(*hRuns)|
|00003a90| 5b 72 75 6e 49 6e 64 65 | 78 20 2d 20 31 5d 2e 73 |[runInde|x - 1].s|
|00003aa0| 74 79 6c 65 49 6e 64 65 | 78 20 3d 3d 20 6e 65 77 |tyleInde|x == new|
|00003ab0| 53 74 79 6c 65 49 6e 64 | 65 78 29 29 0d 09 09 7b |StyleInd|ex))...{|
|00003ac0| 0d 09 09 09 5f 57 45 52 | 65 6d 6f 76 65 52 75 6e |...._WER|emoveRun|
|00003ad0| 28 72 75 6e 49 6e 64 65 | 78 2c 20 70 57 45 29 3b |(runInde|x, pWE);|
|00003ae0| 0d 09 09 09 72 75 6e 49 | 6e 64 65 78 2d 2d 3b 0d |....runI|ndex--;.|
|00003af0| 09 09 7d 0d 0d 09 09 2f | 2f 20 73 74 79 6c 65 20 |..}..../|/ style |
|00003b00| 69 6e 64 65 78 20 63 68 | 61 6e 67 65 64 3f 0d 09 |index ch|anged?..|
|00003b10| 09 69 66 20 28 6f 6c 64 | 53 74 79 6c 65 49 6e 64 |.if (old|StyleInd|
|00003b20| 65 78 20 21 3d 20 6e 65 | 77 53 74 79 6c 65 49 6e |ex != ne|wStyleIn|
|00003b30| 64 65 78 29 0d 09 09 7b | 0d 09 09 09 2f 2f 20 69 |dex)...{|....// i|
|00003b40| 66 20 6f 66 66 73 65 74 | 20 69 73 20 69 6e 20 74 |f offset| is in t|
|00003b50| 68 65 20 6d 69 64 64 6c | 65 20 6f 66 20 61 20 73 |he middl|e of a s|
|00003b60| 74 79 6c 65 20 72 75 6e | 2c 20 69 6e 73 65 72 74 |tyle run|, insert|
|00003b70| 20 61 20 6e 65 77 20 73 | 74 79 6c 65 20 72 75 6e | a new s|tyle run|
|00003b80| 20 69 6e 20 74 68 65 20 | 72 75 6e 20 61 72 72 61 | in the |run arra|
|00003b90| 79 0d 09 09 09 69 66 20 | 28 6f 66 66 73 65 74 20 |y....if |(offset |
|00003ba0| 3e 20 72 75 6e 49 6e 66 | 6f 2e 72 75 6e 53 74 61 |> runInf|o.runSta|
|00003bb0| 72 74 29 0d 09 09 09 7b | 0d 09 09 09 09 69 66 20 |rt)....{|.....if |
|00003bc0| 28 28 65 72 72 20 3d 20 | 5f 57 45 49 6e 73 65 72 |((err = |_WEInser|
|00003bd0| 74 52 75 6e 28 72 75 6e | 49 6e 64 65 78 2c 20 6f |tRun(run|Index, o|
|00003be0| 66 66 73 65 74 2c 20 6e | 65 77 53 74 79 6c 65 49 |ffset, n|ewStyleI|
|00003bf0| 6e 64 65 78 2c 20 70 57 | 45 29 29 20 21 3d 20 6e |ndex, pW|E)) != n|
|00003c00| 6f 45 72 72 29 0d 09 09 | 09 09 7b 0d 09 09 09 09 |oErr)...|..{.....|
|00003c10| 09 67 6f 74 6f 20 63 6c | 65 61 6e 75 70 3b 0d 09 |.goto cl|eanup;..|
|00003c20| 09 09 09 7d 0d 09 09 09 | 09 72 75 6e 49 6e 64 65 |...}....|.runInde|
|00003c30| 78 2b 2b 3b 0d 09 09 09 | 7d 0d 09 09 09 65 6c 73 |x++;....|}....els|
|00003c40| 65 0d 09 09 09 7b 0d 09 | 09 09 09 2f 2f 20 6f 74 |e....{..|...// ot|
|00003c50| 68 65 72 77 69 73 65 20 | 6a 75 73 74 20 63 68 61 |herwise |just cha|
|00003c60| 6e 67 65 20 74 68 65 20 | 73 74 79 6c 65 49 6e 64 |nge the |styleInd|
|00003c70| 65 78 20 66 69 65 6c 64 | 20 6f 66 20 74 68 65 20 |ex field| of the |
|00003c80| 63 75 72 72 65 6e 74 20 | 73 74 79 6c 65 20 72 75 |current |style ru|
|00003c90| 6e 20 65 6e 74 72 79 0d | 09 09 09 09 5f 57 45 43 |n entry.|...._WEC|
|00003ca0| 68 61 6e 67 65 52 75 6e | 28 72 75 6e 49 6e 64 65 |hangeRun|(runInde|
|00003cb0| 78 2c 20 6e 65 77 53 74 | 79 6c 65 49 6e 64 65 78 |x, newSt|yleIndex|
|00003cc0| 2c 20 28 72 61 6e 67 65 | 45 6e 64 20 3c 20 72 75 |, (range|End < ru|
|00003cd0| 6e 49 6e 66 6f 2e 72 75 | 6e 45 6e 64 29 2c 20 70 |nInfo.ru|nEnd), p|
|00003ce0| 57 45 29 3b 0d 09 09 09 | 7d 0d 0d 09 09 09 2f 2f |WE);....|}.....//|
|00003cf0| 20 69 66 20 73 70 65 63 | 69 66 69 65 64 20 72 61 | if spec|ified ra|
|00003d00| 6e 67 65 20 65 6e 64 73 | 20 69 6e 20 74 68 65 20 |nge ends| in the |
|00003d10| 6d 69 64 64 6c 65 20 6f | 66 20 61 20 73 74 79 6c |middle o|f a styl|
|00003d20| 65 20 72 75 6e 2c 20 69 | 6e 73 65 72 74 20 79 65 |e run, i|nsert ye|
|00003d30| 74 20 61 6e 6f 74 68 65 | 72 20 65 6e 74 72 79 0d |t anothe|r entry.|
|00003d40| 09 09 09 69 66 20 28 72 | 61 6e 67 65 45 6e 64 20 |...if (r|angeEnd |
|00003d50| 3c 20 72 75 6e 49 6e 66 | 6f 2e 72 75 6e 45 6e 64 |< runInf|o.runEnd|
|00003d60| 29 0d 09 09 09 7b 0d 09 | 09 09 09 69 66 20 28 28 |)....{..|...if ((|
|00003d70| 65 72 72 20 3d 20 5f 57 | 45 49 6e 73 65 72 74 52 |err = _W|EInsertR|
|00003d80| 75 6e 28 72 75 6e 49 6e | 64 65 78 2c 20 72 61 6e |un(runIn|dex, ran|
|00003d90| 67 65 45 6e 64 2c 20 6f | 6c 64 53 74 79 6c 65 49 |geEnd, o|ldStyleI|
|00003da0| 6e 64 65 78 2c 20 70 57 | 45 29 29 20 21 3d 20 6e |ndex, pW|E)) != n|
|00003db0| 6f 45 72 72 29 0d 09 09 | 09 09 7b 0d 09 09 09 09 |oErr)...|..{.....|
|00003dc0| 09 67 6f 74 6f 20 63 6c | 65 61 6e 75 70 3b 0d 09 |.goto cl|eanup;..|
|00003dd0| 09 09 09 7d 0d 09 09 09 | 7d 0d 09 09 7d 20 2f 2f |...}....|}...} //|
|00003de0| 20 69 66 20 6f 6c 64 53 | 74 79 6c 65 20 21 3d 20 | if oldS|tyle != |
|00003df0| 6e 65 77 53 74 79 6c 65 | 0d 0d 09 09 2f 2f 20 67 |newStyle|....// g|
|00003e00| 6f 20 74 6f 20 6e 65 78 | 74 20 73 74 79 6c 65 20 |o to nex|t style |
|00003e10| 72 75 6e 0d 09 09 72 75 | 6e 49 6e 64 65 78 2b 2b |run...ru|nIndex++|
|00003e20| 3b 0d 09 09 6f 66 66 73 | 65 74 20 3d 20 72 75 6e |;...offs|et = run|
|00003e30| 49 6e 66 6f 2e 72 75 6e | 45 6e 64 3b 0d 0d 09 7d |Info.run|End;...}|
|00003e40| 20 77 68 69 6c 65 20 28 | 6f 66 66 73 65 74 20 3c | while (|offset <|
|00003e50| 20 72 61 6e 67 65 45 6e | 64 29 3b 0d 0d 09 2f 2f | rangeEn|d);...//|
|00003e60| 20 69 66 20 74 68 65 20 | 6c 61 73 74 20 73 74 79 | if the |last sty|
|00003e70| 6c 65 20 72 75 6e 20 65 | 6e 64 73 20 65 78 61 63 |le run e|nds exac|
|00003e80| 74 6c 79 20 61 74 20 74 | 68 65 20 65 6e 64 20 6f |tly at t|he end o|
|00003e90| 66 20 74 68 65 20 73 70 | 65 63 69 66 69 65 64 20 |f the sp|ecified |
|00003ea0| 72 61 6e 67 65 2c 0d 09 | 2f 2f 20 73 65 65 20 69 |range,..|// see i|
|00003eb0| 66 20 77 65 20 63 61 6e | 20 6d 65 72 67 65 20 69 |f we can| merge i|
|00003ec0| 74 20 77 69 74 68 20 74 | 68 65 20 66 6f 6c 6c 6f |t with t|he follo|
|00003ed0| 77 69 6e 67 20 73 74 79 | 6c 65 20 72 75 6e 0d 09 |wing sty|le run..|
|00003ee0| 69 66 20 28 28 6f 66 66 | 73 65 74 20 3d 3d 20 72 |if ((off|set == r|
|00003ef0| 61 6e 67 65 45 6e 64 29 | 20 26 26 20 28 72 75 6e |angeEnd)| && (run|
|00003f00| 49 6e 64 65 78 20 3c 20 | 70 57 45 2d 3e 6e 52 75 |Index < |pWE->nRu|
|00003f10| 6e 73 29 20 26 26 0d 09 | 09 28 28 2a 68 52 75 6e |ns) &&..|.((*hRun|
|00003f20| 73 29 5b 72 75 6e 49 6e | 64 65 78 5d 2e 73 74 79 |s)[runIn|dex].sty|
|00003f30| 6c 65 49 6e 64 65 78 20 | 3d 3d 20 6e 65 77 53 74 |leIndex |== newSt|
|00003f40| 79 6c 65 49 6e 64 65 78 | 29 29 0d 09 7b 0d 09 09 |yleIndex|))..{...|
|00003f50| 5f 57 45 52 65 6d 6f 76 | 65 52 75 6e 28 72 75 6e |_WERemov|eRun(run|
|00003f60| 49 6e 64 65 78 2c 20 70 | 57 45 29 3b 0d 09 7d 0d |Index, p|WE);..}.|
|00003f70| 0d 09 2f 2f 20 63 6c 65 | 61 72 20 72 65 73 75 6c |..// cle|ar resul|
|00003f80| 74 20 63 6f 64 65 0d 09 | 65 72 72 20 3d 20 6e 6f |t code..|err = no|
|00003f90| 45 72 72 3b 0d 0d 63 6c | 65 61 6e 75 70 3a 0d 09 |Err;..cl|eanup:..|
|00003fa0| 2f 2f 20 72 65 74 75 72 | 6e 20 72 65 73 75 6c 74 |// retur|n result|
|00003fb0| 20 63 6f 64 65 0d 09 72 | 65 74 75 72 6e 20 65 72 | code..r|eturn er|
|00003fc0| 72 3b 0d 7d 0d 0d 70 61 | 73 63 61 6c 20 4f 53 45 |r;.}..pa|scal OSE|
|00003fd0| 72 72 20 5f 57 45 41 70 | 70 6c 79 53 74 79 6c 65 |rr _WEAp|plyStyle|
|00003fe0| 53 63 72 61 70 28 53 49 | 6e 74 33 32 20 72 61 6e |Scrap(SI|nt32 ran|
|00003ff0| 67 65 53 74 61 72 74 2c | 20 53 49 6e 74 33 32 20 |geStart,| SInt32 |
|00004000| 72 61 6e 67 65 45 6e 64 | 2c 20 53 74 53 63 72 70 |rangeEnd|, StScrp|
|00004010| 48 61 6e 64 6c 65 20 73 | 74 79 6c 65 53 63 72 61 |Handle s|tyleScra|
|00004020| 70 2c 20 57 45 48 61 6e | 64 6c 65 20 68 57 45 29 |p, WEHan|dle hWE)|
|00004030| 0d 7b 0d 09 2f 2f 20 61 | 70 70 6c 79 20 74 68 65 |.{..// a|pply the|
|00004040| 20 67 69 76 65 6e 20 73 | 74 79 6c 65 20 73 63 72 | given s|tyle scr|
|00004050| 61 70 20 74 6f 20 74 68 | 65 20 73 70 65 63 69 66 |ap to th|e specif|
|00004060| 69 65 64 20 74 65 78 74 | 20 72 61 6e 67 65 0d 0d |ied text| range..|
|00004070| 09 54 45 53 74 79 6c 65 | 53 63 72 61 70 45 6c 65 |.TEStyle|ScrapEle|
|00004080| 6d 65 6e 74 20 2a 70 45 | 6e 74 72 79 3b 0d 09 53 |ment *pE|ntry;..S|
|00004090| 69 7a 65 20 73 74 79 6c | 65 53 63 72 61 70 53 69 |ize styl|eScrapSi|
|000040a0| 7a 65 3b 0d 09 53 49 6e | 74 33 32 20 72 75 6e 53 |ze;..SIn|t32 runS|
|000040b0| 74 61 72 74 2c 20 72 75 | 6e 45 6e 64 3b 0d 09 53 |tart, ru|nEnd;..S|
|000040c0| 49 6e 74 33 32 20 65 6e | 74 72 79 43 6f 75 6e 74 |Int32 en|tryCount|
|000040d0| 2c 20 69 6e 64 65 78 3b | 0d 09 57 45 54 65 78 74 |, index;|..WEText|
|000040e0| 53 74 79 6c 65 20 74 73 | 3b 0d 09 4f 53 45 72 72 |Style ts|;..OSErr|
|000040f0| 20 65 72 72 3b 0d 0d 09 | 2f 2f 20 73 61 6e 69 74 | err;...|// sanit|
|00004100| 79 20 63 68 65 63 6b 3a | 20 6d 61 6b 65 20 73 75 |y check:| make su|
|00004110| 72 65 20 74 68 65 20 73 | 74 79 6c 65 20 73 63 72 |re the s|tyle scr|
|00004120| 61 70 20 68 61 6e 64 6c | 65 20 69 73 20 61 20 72 |ap handl|e is a r|
|00004130| 65 61 73 6f 6e 61 62 6c | 65 20 73 69 7a 65 0d 09 |easonabl|e size..|
|00004140| 65 72 72 20 3d 20 77 65 | 43 6f 72 72 75 70 74 44 |err = we|CorruptD|
|00004150| 61 74 61 45 72 72 3b 0d | 09 73 74 79 6c 65 53 63 |ataErr;.|.styleSc|
|00004160| 72 61 70 53 69 7a 65 20 | 3d 20 47 65 74 48 61 6e |rapSize |= GetHan|
|00004170| 64 6c 65 53 69 7a 65 28 | 28 48 61 6e 64 6c 65 29 |dleSize(|(Handle)|
|00004180| 20 73 74 79 6c 65 53 63 | 72 61 70 29 20 2d 20 73 | styleSc|rap) - s|
|00004190| 69 7a 65 6f 66 28 53 49 | 6e 74 31 36 29 3b 0d 09 |izeof(SI|nt16);..|
|000041a0| 69 66 20 28 73 74 79 6c | 65 53 63 72 61 70 53 69 |if (styl|eScrapSi|
|000041b0| 7a 65 20 3c 20 30 29 0d | 09 7b 0d 09 09 67 6f 74 |ze < 0).|.{...got|
|000041c0| 6f 20 63 6c 65 61 6e 75 | 70 3b 09 09 2f 2f 20 74 |o cleanu|p;..// t|
|000041d0| 6f 6f 20 73 68 6f 72 74 | 3a 20 68 65 61 64 65 72 |oo short|: header|
|000041e0| 20 69 73 20 6d 69 73 73 | 69 6e 67 0d 09 7d 0d 0d | is miss|ing..}..|
|000041f0| 09 2f 2f 20 63 61 6c 63 | 75 6c 61 74 65 20 65 6e |.// calc|ulate en|
|00004200| 74 72 79 20 63 6f 75 6e | 74 20 62 61 73 65 64 20 |try coun|t based |
|00004210| 6f 6e 20 68 61 6e 64 6c | 65 20 73 69 7a 65 0d 09 |on handl|e size..|
|00004220| 65 6e 74 72 79 43 6f 75 | 6e 74 20 3d 20 73 74 79 |entryCou|nt = sty|
|00004230| 6c 65 53 63 72 61 70 53 | 69 7a 65 20 2f 20 73 69 |leScrapS|ize / si|
|00004240| 7a 65 6f 66 28 53 63 72 | 70 53 54 45 6c 65 6d 65 |zeof(Scr|pSTEleme|
|00004250| 6e 74 29 3b 0d 09 69 66 | 20 28 73 74 79 6c 65 53 |nt);..if| (styleS|
|00004260| 63 72 61 70 53 69 7a 65 | 20 21 3d 20 65 6e 74 72 |crapSize| != entr|
|00004270| 79 43 6f 75 6e 74 20 2a | 20 73 69 7a 65 6f 66 28 |yCount *| sizeof(|
|00004280| 53 63 72 70 53 54 45 6c | 65 6d 65 6e 74 29 29 0d |ScrpSTEl|ement)).|
|00004290| 09 7b 0d 09 09 67 6f 74 | 6f 20 63 6c 65 61 6e 75 |.{...got|o cleanu|
|000042a0| 70 3b 09 09 2f 2f 20 6e | 6f 74 20 61 6e 20 69 6e |p;..// n|ot an in|
|000042b0| 74 65 67 72 61 6c 20 6e | 75 6d 62 65 72 20 6f 66 |tegral n|umber of|
|000042c0| 20 65 6e 74 72 69 65 73 | 0d 09 7d 0d 0d 09 2f 2f | entries|..}...//|
|000042d0| 20 74 68 65 20 63 61 6c | 63 75 6c 61 74 65 64 20 | the cal|culated |
|000042e0| 65 6e 74 72 79 20 63 6f | 75 6e 74 20 6d 75 73 74 |entry co|unt must|
|000042f0| 20 6d 61 74 63 68 20 73 | 63 72 70 4e 53 74 79 6c | match s|crpNStyl|
|00004300| 65 73 2c 0d 09 2f 2f 20 | 75 6e 6c 65 73 73 20 69 |es,..// |unless i|
|00004310| 74 27 73 20 6c 61 72 67 | 65 72 20 74 68 61 6e 20 |t's larg|er than |
|00004320| 33 32 2c 37 36 36 0d 09 | 69 66 20 28 65 6e 74 72 |32,766..|if (entr|
|00004330| 79 43 6f 75 6e 74 20 3c | 20 53 48 52 54 5f 4d 41 |yCount <| SHRT_MA|
|00004340| 58 29 0d 09 7b 0d 09 09 | 69 66 20 28 65 6e 74 72 |X)..{...|if (entr|
|00004350| 79 43 6f 75 6e 74 20 21 | 3d 20 28 2a 73 74 79 6c |yCount !|= (*styl|
|00004360| 65 53 63 72 61 70 29 2d | 3e 73 63 72 70 4e 53 74 |eScrap)-|>scrpNSt|
|00004370| 79 6c 65 73 29 0d 09 09 | 7b 0d 09 09 09 67 6f 74 |yles)...|{....got|
|00004380| 6f 20 63 6c 65 61 6e 75 | 70 3b 09 2f 2f 20 69 6e |o cleanu|p;.// in|
|00004390| 76 61 6c 69 64 20 65 6e | 74 72 79 20 63 6f 75 6e |valid en|try coun|
|000043a0| 74 0d 09 09 7d 0d 09 7d | 0d 0d 09 2f 2f 20 6c 6f |t...}..}|...// lo|
|000043b0| 6f 70 20 74 68 72 6f 75 | 67 68 20 65 61 63 68 20 |op throu|gh each |
|000043c0| 65 6e 74 72 79 20 6f 66 | 20 74 68 65 20 73 74 79 |entry of| the sty|
|000043d0| 6c 65 20 73 63 72 61 70 | 0d 09 66 6f 72 20 28 20 |le scrap|..for ( |
|000043e0| 69 6e 64 65 78 20 3d 20 | 30 3b 20 69 6e 64 65 78 |index = |0; index|
|000043f0| 20 3c 20 65 6e 74 72 79 | 43 6f 75 6e 74 3b 20 69 | < entry|Count; i|
|00004400| 6e 64 65 78 2b 2b 20 29 | 0d 09 7b 0d 09 09 2f 2f |ndex++ )|..{...//|
|00004410| 20 67 65 74 20 61 20 70 | 6f 69 6e 74 65 72 20 74 | get a p|ointer t|
|00004420| 6f 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 73 63 |o the cu|rrent sc|
|00004430| 72 61 70 20 65 6e 74 72 | 79 0d 09 09 70 45 6e 74 |rap entr|y...pEnt|
|00004440| 72 79 20 3d 20 28 54 45 | 53 74 79 6c 65 53 63 72 |ry = (TE|StyleScr|
|00004450| 61 70 45 6c 65 6d 65 6e | 74 20 2a 29 20 28 28 2a |apElemen|t *) ((*|
|00004460| 73 74 79 6c 65 53 63 72 | 61 70 29 2d 3e 73 63 72 |styleScr|ap)->scr|
|00004470| 70 53 74 79 6c 65 54 61 | 62 20 2b 20 69 6e 64 65 |pStyleTa|b + inde|
|00004480| 78 29 3b 0d 0d 09 09 2f | 2f 20 63 61 6c 63 75 6c |x);..../|/ calcul|
|00004490| 61 74 65 20 74 65 78 74 | 20 72 75 6e 20 74 6f 20 |ate text| run to |
|000044a0| 77 68 69 63 68 20 74 68 | 69 73 20 65 6e 74 72 79 |which th|is entry|
|000044b0| 20 69 73 20 74 6f 20 62 | 65 20 61 70 70 6c 69 65 | is to b|e applie|
|000044c0| 64 0d 09 09 72 75 6e 53 | 74 61 72 74 20 3d 20 72 |d...runS|tart = r|
|000044d0| 61 6e 67 65 53 74 61 72 | 74 20 2b 20 70 45 6e 74 |angeStar|t + pEnt|
|000044e0| 72 79 2d 3e 73 63 72 70 | 53 74 61 72 74 43 68 61 |ry->scrp|StartCha|
|000044f0| 72 3b 0d 09 09 69 66 20 | 28 69 6e 64 65 78 20 3c |r;...if |(index <|
|00004500| 20 65 6e 74 72 79 43 6f | 75 6e 74 20 2d 20 31 29 | entryCo|unt - 1)|
|00004510| 0d 09 09 7b 0d 09 09 09 | 72 75 6e 45 6e 64 20 3d |...{....|runEnd =|
|00004520| 20 72 61 6e 67 65 53 74 | 61 72 74 20 2b 20 70 45 | rangeSt|art + pE|
|00004530| 6e 74 72 79 5b 31 5d 2e | 73 63 72 70 53 74 61 72 |ntry[1].|scrpStar|
|00004540| 74 43 68 61 72 3b 0d 09 | 09 7d 0d 09 09 65 6c 73 |tChar;..|.}...els|
|00004550| 65 0d 09 09 7b 0d 09 09 | 09 72 75 6e 45 6e 64 20 |e...{...|.runEnd |
|00004560| 3d 20 72 61 6e 67 65 45 | 6e 64 3b 0d 09 09 7d 0d |= rangeE|nd;...}.|
|00004570| 0d 09 09 2f 2f 20 70 65 | 72 66 6f 72 6d 20 73 6f |...// pe|rform so|
|00004580| 6d 65 20 72 61 6e 67 65 | 20 63 68 65 63 6b 69 6e |me range| checkin|
|00004590| 67 0d 09 09 69 66 20 28 | 72 75 6e 45 6e 64 20 3e |g...if (|runEnd >|
|000045a0| 20 72 61 6e 67 65 45 6e | 64 29 0d 09 09 7b 0d 09 | rangeEn|d)...{..|
|000045b0| 09 09 72 75 6e 45 6e 64 | 20 3d 20 72 61 6e 67 65 |..runEnd| = range|
|000045c0| 45 6e 64 3b 0d 09 09 7d | 0d 09 09 69 66 20 28 72 |End;...}|...if (r|
|000045d0| 75 6e 53 74 61 72 74 20 | 3e 3d 20 72 75 6e 45 6e |unStart |>= runEn|
|000045e0| 64 29 0d 09 09 7b 0d 09 | 09 09 63 6f 6e 74 69 6e |d)...{..|..contin|
|000045f0| 75 65 3b 0d 09 09 7d 0d | 0d 09 09 2f 2f 20 63 6f |ue;...}.|...// co|
|00004600| 70 79 20 73 74 79 6c 65 | 20 74 6f 20 61 20 6c 6f |py style| to a lo|
|00004610| 63 61 6c 20 76 61 72 69 | 61 62 6c 65 20 69 6e 20 |cal vari|able in |
|00004620| 63 61 73 65 20 6d 65 6d | 6f 72 79 20 6d 6f 76 65 |case mem|ory move|
|00004630| 73 0d 09 09 2a 20 28 54 | 65 78 74 53 74 79 6c 65 |s...* (T|extStyle|
|00004640| 20 2a 29 20 26 74 73 20 | 3d 20 70 45 6e 74 72 79 | *) &ts |= pEntry|
|00004650| 2d 3e 73 63 72 70 54 45 | 41 74 74 72 73 2e 72 75 |->scrpTE|Attrs.ru|
|00004660| 6e 54 45 53 74 79 6c 65 | 3b 0d 0d 09 09 2f 2f 20 |nTEStyle|;....// |
|00004670| 61 70 70 6c 79 20 74 68 | 65 20 73 70 65 63 69 66 |apply th|e specif|
|00004680| 69 65 64 20 73 74 79 6c | 65 20 74 6f 20 74 68 65 |ied styl|e to the|
|00004690| 20 72 61 6e 67 65 0d 09 | 09 69 66 20 28 28 65 72 | range..|.if ((er|
|000046a0| 72 20 3d 20 5f 57 45 53 | 65 74 53 74 79 6c 65 52 |r = _WES|etStyleR|
|000046b0| 61 6e 67 65 28 72 75 6e | 53 74 61 72 74 2c 20 72 |ange(run|Start, r|
|000046c0| 75 6e 45 6e 64 2c 20 77 | 65 44 6f 41 6c 6c 20 2b |unEnd, w|eDoAll +|
|000046d0| 20 77 65 44 6f 52 65 70 | 6c 61 63 65 46 61 63 65 | weDoRep|laceFace|
|000046e0| 2c 20 26 74 73 2c 20 68 | 57 45 29 29 20 21 3d 20 |, &ts, h|WE)) != |
|000046f0| 6e 6f 45 72 72 29 0d 09 | 09 7b 0d 09 09 09 67 6f |noErr)..|.{....go|
|00004700| 74 6f 20 63 6c 65 61 6e | 75 70 3b 0d 09 09 7d 0d |to clean|up;...}.|
|00004710| 09 7d 0d 0d 09 2f 2f 20 | 63 6c 65 61 72 20 72 65 |.}...// |clear re|
|00004720| 73 75 6c 74 20 63 6f 64 | 65 0d 09 65 72 72 20 3d |sult cod|e..err =|
|00004730| 20 6e 6f 45 72 72 3b 0d | 0d 63 6c 65 61 6e 75 70 | noErr;.|.cleanup|
|00004740| 3a 0d 09 2f 2f 20 72 65 | 74 75 72 6e 20 72 65 73 |:..// re|turn res|
|00004750| 75 6c 74 20 63 6f 64 65 | 0d 09 72 65 74 75 72 6e |ult code|..return|
|00004760| 20 65 72 72 3b 0d 7d 0d | 0d 23 69 66 20 57 41 53 | err;.}.|.#if WAS|
|00004770| 54 45 5f 4f 42 4a 45 43 | 54 53 0d 0d 70 61 73 63 |TE_OBJEC|TS..pasc|
|00004780| 61 6c 20 4f 53 45 72 72 | 20 5f 57 45 41 70 70 6c |al OSErr| _WEAppl|
|00004790| 79 53 6f 75 70 28 53 49 | 6e 74 33 32 20 6f 66 66 |ySoup(SI|nt32 off|
|000047a0| 73 65 74 2c 20 57 45 53 | 6f 75 70 48 61 6e 64 6c |set, WES|oupHandl|
|000047b0| 65 20 68 53 6f 75 70 2c | 20 57 45 48 61 6e 64 6c |e hSoup,| WEHandl|
|000047c0| 65 20 68 57 45 29 0d 7b | 0d 09 57 45 53 6f 75 70 |e hWE).{|..WESoup|
|000047d0| 20 73 6f 75 70 3b 0d 09 | 50 74 72 20 70 53 6f 75 | soup;..|Ptr pSou|
|000047e0| 70 2c 20 70 53 6f 75 70 | 45 6e 64 3b 0d 09 57 45 |p, pSoup|End;..WE|
|000047f0| 53 74 79 6c 65 4d 6f 64 | 65 20 6d 6f 64 65 3b 0d |StyleMod|e mode;.|
|00004800| 09 57 45 54 65 78 74 53 | 74 79 6c 65 20 74 73 3b |.WETextS|tyle ts;|
|00004810| 0d 09 48 61 6e 64 6c 65 | 20 68 4f 62 6a 65 63 74 |..Handle| hObject|
|00004820| 44 61 74 61 3b 0d 09 53 | 49 6e 74 33 32 20 6f 62 |Data;..S|Int32 ob|
|00004830| 6a 65 63 74 53 74 61 72 | 74 3b 0d 09 53 49 6e 74 |jectStar|t;..SInt|
|00004840| 33 32 20 6f 62 6a 65 63 | 74 45 6e 64 3b 0d 09 42 |32 objec|tEnd;..B|
|00004850| 6f 6f 6c 65 61 6e 20 73 | 61 76 65 57 45 4c 6f 63 |oolean s|aveWELoc|
|00004860| 6b 3b 0d 09 4f 53 45 72 | 72 20 65 72 72 3b 0d 0d |k;..OSEr|r err;..|
|00004870| 09 6d 6f 64 65 20 3d 20 | 30 3b 0d 09 42 4c 4f 43 |.mode = |0;..BLOC|
|00004880| 4b 5f 43 4c 52 28 74 73 | 29 3b 0d 09 68 4f 62 6a |K_CLR(ts|);..hObj|
|00004890| 65 63 74 44 61 74 61 20 | 3d 20 6e 69 6c 3b 0d 0d |ectData |= nil;..|
|000048a0| 09 2f 2f 20 6c 6f 63 6b | 20 74 68 65 20 57 45 20 |.// lock| the WE |
|000048b0| 72 65 63 6f 72 64 0d 09 | 73 61 76 65 57 45 4c 6f |record..|saveWELo|
|000048c0| 63 6b 20 3d 20 5f 57 45 | 53 65 74 48 61 6e 64 6c |ck = _WE|SetHandl|
|000048d0| 65 4c 6f 63 6b 28 28 48 | 61 6e 64 6c 65 29 20 68 |eLock((H|andle) h|
|000048e0| 57 45 2c 20 74 72 75 65 | 29 3b 0d 0d 09 2f 2f 20 |WE, true|);...// |
|000048f0| 6c 6f 63 6b 20 74 68 65 | 20 73 6f 75 70 20 69 6e |lock the| soup in|
|00004900| 20 68 69 67 68 20 68 65 | 61 70 0d 09 48 4c 6f 63 | high he|ap..HLoc|
|00004910| 6b 48 69 28 68 53 6f 75 | 70 29 3b 0d 09 70 53 6f |kHi(hSou|p);..pSo|
|00004920| 75 70 20 3d 20 2a 68 53 | 6f 75 70 3b 0d 09 70 53 |up = *hS|oup;..pS|
|00004930| 6f 75 70 45 6e 64 20 3d | 20 70 53 6f 75 70 20 2b |oupEnd =| pSoup +|
|00004940| 20 47 65 74 48 61 6e 64 | 6c 65 53 69 7a 65 28 68 | GetHand|leSize(h|
|00004950| 53 6f 75 70 29 3b 0d 0d | 09 2f 2f 20 6c 6f 6f 70 |Soup);..|.// loop|
|00004960| 20 74 68 72 6f 75 67 68 | 20 65 61 63 68 20 6f 62 | through| each ob|
|00004970| 6a 65 63 74 20 64 65 73 | 63 72 69 70 74 6f 72 20 |ject des|criptor |
|00004980| 69 6e 20 74 68 65 20 73 | 6f 75 70 0d 09 77 68 69 |in the s|oup..whi|
|00004990| 6c 65 20 28 70 53 6f 75 | 70 20 3c 20 70 53 6f 75 |le (pSou|p < pSou|
|000049a0| 70 45 6e 64 29 0d 09 7b | 0d 09 09 2f 2f 20 4f 62 |pEnd)..{|...// Ob|
|000049b0| 6a 65 63 74 20 64 65 73 | 63 72 69 70 74 6f 72 73 |ject des|criptors|
|000049c0| 20 6d 61 79 20 62 65 20 | 61 6c 69 67 6e 65 64 20 | may be |aligned |
|000049d0| 74 6f 20 6f 64 64 20 61 | 64 64 72 65 73 73 65 73 |to odd a|ddresses|
|000049e0| 20 28 64 75 68 21 29 0d | 09 09 2f 2f 20 74 68 69 | (duh!).|..// thi|
|000049f0| 73 20 69 73 6e 27 74 20 | 61 20 70 72 6f 62 6c 65 |s isn't |a proble|
|00004a00| 6d 20 6f 6e 20 36 38 30 | 32 30 2b 20 61 6e 64 20 |m on 680|20+ and |
|00004a10| 50 50 43 20 43 50 55 73 | 2c 20 62 75 74 20 63 61 |PPC CPUs|, but ca|
|00004a20| 75 73 65 73 0d 09 09 2f | 2f 20 61 20 66 61 74 61 |uses.../|/ a fata|
|00004a30| 6c 20 61 64 64 72 65 73 | 73 20 65 72 72 6f 72 20 |l addres|s error |
|00004a40| 6f 6e 20 74 68 65 20 36 | 38 30 30 30 2e 20 20 54 |on the 6|8000. T|
|00004a50| 6f 20 61 76 6f 69 64 20 | 74 68 69 73 2c 20 77 65 |o avoid |this, we|
|00004a60| 0d 09 09 2f 2f 20 63 6f | 70 79 20 74 68 65 20 64 |...// co|py the d|
|00004a70| 65 73 63 72 69 70 74 6f | 72 20 74 6f 20 74 68 65 |escripto|r to the|
|00004a80| 20 73 74 61 63 6b 20 77 | 69 74 68 20 42 6c 6f 63 | stack w|ith Bloc|
|00004a90| 6b 4d 6f 76 65 44 61 74 | 61 28 29 0d 09 09 2f 2f |kMoveDat|a()...//|
|00004aa0| 20 62 65 66 6f 72 65 20 | 74 72 79 69 6e 67 20 74 | before |trying t|
|00004ab0| 6f 20 61 63 63 65 73 73 | 20 69 74 73 20 66 69 65 |o access| its fie|
|00004ac0| 6c 64 73 2e 0d 09 09 42 | 6c 6f 63 6b 4d 6f 76 65 |lds....B|lockMove|
|00004ad0| 44 61 74 61 28 70 53 6f | 75 70 2c 20 26 73 6f 75 |Data(pSo|up, &sou|
|00004ae0| 70 2c 20 73 69 7a 65 6f | 66 28 73 6f 75 70 29 29 |p, sizeo|f(soup))|
|00004af0| 3b 0d 0d 09 09 2f 2f 20 | 69 66 20 73 6f 75 70 44 |;....// |if soupD|
|00004b00| 61 74 61 53 69 7a 65 20 | 69 73 20 6e 65 67 61 74 |ataSize |is negat|
|00004b10| 69 76 65 2c 20 74 68 69 | 73 20 73 6f 75 70 20 69 |ive, thi|s soup i|
|00004b20| 73 20 61 20 73 70 65 63 | 69 61 6c 20 74 79 70 65 |s a spec|ial type|
|00004b30| 20 74 68 61 74 20 77 65 | 20 77 6f 6e 27 74 20 68 | that we| won't h|
|00004b40| 61 6e 64 6c 65 20 68 65 | 72 65 0d 09 09 69 66 20 |andle he|re...if |
|00004b50| 28 73 6f 75 70 2e 73 6f | 75 70 44 61 74 61 53 69 |(soup.so|upDataSi|
|00004b60| 7a 65 20 3c 20 30 29 0d | 09 09 7b 0d 09 09 09 63 |ze < 0).|..{....c|
|00004b70| 6f 6e 74 69 6e 75 65 3b | 0d 09 09 7d 0d 0d 09 09 |ontinue;|...}....|
|00004b80| 2f 2f 20 63 72 65 61 74 | 65 20 61 20 6e 65 77 20 |// creat|e a new |
|00004b90| 72 65 6c 6f 63 61 74 61 | 62 6c 65 20 62 6c 6f 63 |relocata|ble bloc|
|00004ba0| 6b 20 74 68 65 20 68 6f | 6c 64 20 74 68 65 20 6f |k the ho|ld the o|
|00004bb0| 62 6a 65 63 74 20 64 61 | 74 61 0d 09 09 69 66 20 |bject da|ta...if |
|00004bc0| 28 28 65 72 72 20 3d 20 | 5f 57 45 41 6c 6c 6f 63 |((err = |_WEAlloc|
|00004bd0| 61 74 65 28 73 6f 75 70 | 2e 73 6f 75 70 44 61 74 |ate(soup|.soupDat|
|00004be0| 61 53 69 7a 65 2c 20 6b | 41 6c 6c 6f 63 54 65 6d |aSize, k|AllocTem|
|00004bf0| 70 2c 20 26 68 4f 62 6a | 65 63 74 44 61 74 61 29 |p, &hObj|ectData)|
|00004c00| 29 20 21 3d 20 6e 6f 45 | 72 72 29 0d 09 09 7b 0d |) != noE|rr)...{.|
|00004c10| 09 09 09 67 6f 74 6f 20 | 63 6c 65 61 6e 75 70 3b |...goto |cleanup;|
|00004c20| 0d 09 09 7d 0d 0d 09 09 | 2f 2f 20 63 6f 70 79 20 |...}....|// copy |
|00004c30| 74 68 65 20 6f 62 6a 65 | 63 74 20 64 61 74 61 20 |the obje|ct data |
|00004c40| 74 6f 20 74 68 69 73 20 | 62 6c 6f 63 6b 0d 09 09 |to this |block...|
|00004c50| 42 6c 6f 63 6b 4d 6f 76 | 65 44 61 74 61 28 70 53 |BlockMov|eData(pS|
|00004c60| 6f 75 70 20 2b 20 73 69 | 7a 65 6f 66 28 73 6f 75 |oup + si|zeof(sou|
|00004c70| 70 29 2c 20 2a 68 4f 62 | 6a 65 63 74 44 61 74 61 |p), *hOb|jectData|
|00004c80| 2c 20 73 6f 75 70 2e 73 | 6f 75 70 44 61 74 61 53 |, soup.s|oupDataS|
|00004c90| 69 7a 65 29 3b 0d 0d 09 | 09 6f 62 6a 65 63 74 53 |ize);...|.objectS|
|00004ca0| 74 61 72 74 20 3d 20 73 | 6f 75 70 2e 73 6f 75 70 |tart = s|oup.soup|
|00004cb0| 4f 66 66 73 65 74 20 2b | 20 6f 66 66 73 65 74 3b |Offset +| offset;|
|00004cc0| 0d 0d 09 09 2f 2f 20 66 | 69 72 73 74 20 73 65 65 |....// f|irst see|
|00004cd0| 20 69 66 20 77 65 20 63 | 61 6e 20 63 72 65 61 74 | if we c|an creat|
|00004ce0| 65 20 61 20 6e 65 77 20 | 73 74 79 6c 65 72 20 6f |e a new |styler o|
|00004cf0| 75 74 20 6f 66 20 74 68 | 65 20 74 61 67 67 65 64 |ut of th|e tagged|
|00004d00| 20 64 61 74 61 0d 09 09 | 65 72 72 20 3d 20 57 45 | data...|err = WE|
|00004d10| 4e 65 77 53 74 79 6c 65 | 72 28 73 6f 75 70 2e 73 |NewStyle|r(soup.s|
|00004d20| 6f 75 70 54 79 70 65 2c | 20 68 4f 62 6a 65 63 74 |oupType,| hObject|
|00004d30| 44 61 74 61 2c 20 68 57 | 45 2c 20 26 74 73 2e 74 |Data, hW|E, &ts.t|
|00004d40| 73 53 74 79 6c 65 72 29 | 3b 0d 09 09 69 66 20 28 |sStyler)|;...if (|
|00004d50| 65 72 72 20 3d 3d 20 6e | 6f 45 72 72 29 0d 09 09 |err == n|oErr)...|
|00004d60| 7b 0d 09 09 09 6d 6f 64 | 65 20 3d 20 77 65 44 6f |{....mod|e = weDo|
|00004d70| 53 74 79 6c 65 72 3b 0d | 09 09 09 0d 09 09 09 2f |Styler;.|......./|
|00004d80| 2f 20 68 61 63 6b 3a 20 | 74 68 65 20 73 74 79 6c |/ hack: |the styl|
|00004d90| 65 72 20 68 61 73 20 61 | 20 6c 65 6e 67 74 68 20 |er has a| length |
|00004da0| 6c 69 6b 65 20 61 20 72 | 75 6e 20 6f 66 20 74 65 |like a r|un of te|
|00004db0| 78 74 20 69 6e 73 74 65 | 61 64 0d 09 09 09 2f 2f |xt inste|ad....//|
|00004dc0| 20 6f 66 20 61 20 64 69 | 6d 65 6e 73 69 6f 6e 20 | of a di|mension |
|00004dd0| 6c 69 6b 65 20 61 6e 20 | 6f 62 6a 65 63 74 0d 09 |like an |object..|
|00004de0| 09 09 6f 62 6a 65 63 74 | 45 6e 64 20 3d 20 6f 62 |..object|End = ob|
|00004df0| 6a 65 63 74 53 74 61 72 | 74 20 2b 20 2a 28 6c 6f |jectStar|t + *(lo|
|00004e00| 6e 67 20 2a 29 26 73 6f | 75 70 2e 73 6f 75 70 53 |ng *)&so|up.soupS|
|00004e10| 69 7a 65 3b 0d 09 09 7d | 0d 09 09 65 6c 73 65 0d |ize;...}|...else.|
|00004e20| 09 09 7b 0d 09 09 09 2f | 2f 20 63 72 65 61 74 65 |..{..../|/ create|
|00004e30| 20 61 20 6e 65 77 20 6f | 62 6a 65 63 74 20 6f 75 | a new o|bject ou|
|00004e40| 74 20 6f 66 20 74 68 65 | 20 74 61 67 67 65 64 20 |t of the| tagged |
|00004e50| 64 61 74 61 0d 09 09 09 | 65 72 72 20 3d 20 5f 57 |data....|err = _W|
|00004e60| 45 4e 65 77 4f 62 6a 65 | 63 74 28 73 6f 75 70 2e |ENewObje|ct(soup.|
|00004e70| 73 6f 75 70 54 79 70 65 | 2c 20 68 4f 62 6a 65 63 |soupType|, hObjec|
|00004e80| 74 44 61 74 61 2c 20 68 | 57 45 2c 20 26 74 73 2e |tData, h|WE, &ts.|
|00004e90| 74 73 4f 62 6a 65 63 74 | 29 3b 0d 09 09 09 69 66 |tsObject|);....if|
|00004ea0| 20 28 65 72 72 20 21 3d | 20 6e 6f 45 72 72 29 0d | (err !=| noErr).|
|00004eb0| 09 09 09 7b 0d 09 09 09 | 09 67 6f 74 6f 20 63 6c |...{....|.goto cl|
|00004ec0| 65 61 6e 75 70 3b 0d 09 | 09 09 7d 0d 0d 09 09 09 |eanup;..|..}.....|
|00004ed0| 6d 6f 64 65 20 3d 20 77 | 65 44 6f 4f 62 6a 65 63 |mode = w|eDoObjec|
|00004ee0| 74 3b 0d 0d 09 09 09 2f | 2f 20 69 66 20 74 68 65 |t;...../|/ if the|
|00004ef0| 72 65 20 77 61 73 20 6e | 6f 20 6e 65 77 20 68 61 |re was n|o new ha|
|00004f00| 6e 64 6c 65 72 20 66 6f | 72 20 74 68 69 73 20 6f |ndler fo|r this o|
|00004f10| 62 6a 65 63 74 2c 20 75 | 73 65 20 74 68 65 20 6f |bject, u|se the o|
|00004f20| 62 6a 65 63 74 20 73 69 | 7a 65 20 73 74 6f 72 65 |bject si|ze store|
|00004f30| 64 20 69 6e 20 74 68 65 | 20 73 6f 75 70 0d 09 09 |d in the| soup...|
|00004f40| 09 69 66 20 28 28 2a 74 | 73 2e 74 73 4f 62 6a 65 |.if ((*t|s.tsObje|
|00004f50| 63 74 29 2d 3e 6f 62 6a | 65 63 74 54 61 62 6c 65 |ct)->obj|ectTable|
|00004f60| 20 3d 3d 20 6e 69 6c 29 | 0d 09 09 09 7b 0d 09 09 | == nil)|....{...|
|00004f70| 09 09 28 2a 74 73 2e 74 | 73 4f 62 6a 65 63 74 29 |..(*ts.t|sObject)|
|00004f80| 2d 3e 6f 62 6a 65 63 74 | 53 69 7a 65 20 3d 20 73 |->object|Size = s|
|00004f90| 6f 75 70 2e 73 6f 75 70 | 53 69 7a 65 3b 0d 09 09 |oup.soup|Size;...|
|00004fa0| 09 7d 0d 09 09 09 0d 09 | 09 09 6f 62 6a 65 63 74 |.}......|..object|
|00004fb0| 45 6e 64 20 3d 20 6f 62 | 6a 65 63 74 53 74 61 72 |End = ob|jectStar|
|00004fc0| 74 20 2b 20 31 3b 0d 09 | 09 7d 0d 0d 09 09 2f 2f |t + 1;..|.}....//|
|00004fd0| 20 72 65 63 6f 72 64 20 | 61 20 72 65 66 65 72 65 | record |a refere|
|00004fe0| 6e 63 65 20 74 6f 20 74 | 68 65 20 6f 62 6a 65 63 |nce to t|he objec|
|00004ff0| 74 20 64 65 73 63 72 69 | 70 74 6f 72 20 69 6e 20 |t descri|ptor in |
|00005000| 74 68 65 20 73 74 79 6c | 65 20 74 61 62 6c 65 0d |the styl|e table.|
|00005010| 09 09 65 72 72 20 3d 20 | 5f 57 45 53 65 74 53 74 |..err = |_WESetSt|
|00005020| 79 6c 65 52 61 6e 67 65 | 28 6f 62 6a 65 63 74 53 |yleRange|(objectS|
|00005030| 74 61 72 74 2c 20 6f 62 | 6a 65 63 74 45 6e 64 2c |tart, ob|jectEnd,|
|00005040| 20 6d 6f 64 65 2c 20 26 | 74 73 2c 20 68 57 45 29 | mode, &|ts, hWE)|
|00005050| 3b 0d 09 09 68 4f 62 6a | 65 63 74 44 61 74 61 20 |;...hObj|ectData |
|00005060| 3d 20 6e 69 6c 3b 0d 09 | 09 6d 6f 64 65 20 3d 20 |= nil;..|.mode = |
|00005070| 30 3b 0d 09 09 74 73 2e | 74 73 53 74 79 6c 65 72 |0;...ts.|tsStyler|
|00005080| 20 3d 20 6e 69 6c 3b 0d | 09 09 74 73 2e 74 73 4f | = nil;.|..ts.tsO|
|00005090| 62 6a 65 63 74 20 3d 20 | 6e 69 6c 3b 0d 09 09 69 |bject = |nil;...i|
|000050a0| 66 20 28 65 72 72 20 21 | 3d 20 6e 6f 45 72 72 29 |f (err !|= noErr)|
|000050b0| 0d 09 09 7b 0d 09 09 09 | 67 6f 74 6f 20 63 6c 65 |...{....|goto cle|
|000050c0| 61 6e 75 70 3b 0d 09 09 | 7d 0d 0d 09 09 2f 2f 20 |anup;...|}....// |
|000050d0| 61 64 76 61 6e 63 65 20 | 73 6f 75 70 20 70 6f 69 |advance |soup poi|
|000050e0| 6e 74 65 72 0d 09 09 70 | 53 6f 75 70 20 2b 3d 20 |nter...p|Soup += |
|000050f0| 73 69 7a 65 6f 66 28 73 | 6f 75 70 29 20 2b 20 73 |sizeof(s|oup) + s|
|00005100| 6f 75 70 2e 73 6f 75 70 | 44 61 74 61 53 69 7a 65 |oup.soup|DataSize|
|00005110| 3b 0d 0d 09 7d 20 2f 2f | 20 77 68 69 6c 65 0d 0d |;...} //| while..|
|00005120| 09 2f 2f 20 63 6c 65 61 | 72 20 72 65 73 75 6c 74 |.// clea|r result|
|00005130| 20 63 6f 64 65 0d 09 65 | 72 72 20 3d 20 6e 6f 45 | code..e|rr = noE|
|00005140| 72 72 3b 0d 0d 63 6c 65 | 61 6e 75 70 3a 0d 09 2f |rr;..cle|anup:../|
|00005150| 2f 20 63 6c 65 61 6e 20 | 75 70 0d 09 48 55 6e 6c |/ clean |up..HUnl|
|00005160| 6f 63 6b 28 68 53 6f 75 | 70 29 3b 0d 09 5f 57 45 |ock(hSou|p);.._WE|
|00005170| 46 6f 72 67 65 74 48 61 | 6e 64 6c 65 28 28 48 61 |ForgetHa|ndle((Ha|
|00005180| 6e 64 6c 65 20 2a 29 20 | 26 74 73 2e 74 73 4f 62 |ndle *) |&ts.tsOb|
|00005190| 6a 65 63 74 29 3b 0d 09 | 5f 57 45 46 6f 72 67 65 |ject);..|_WEForge|
|000051a0| 74 48 61 6e 64 6c 65 28 | 26 68 4f 62 6a 65 63 74 |tHandle(|&hObject|
|000051b0| 44 61 74 61 29 3b 0d 0d | 09 2f 2f 20 75 6e 6c 6f |Data);..|.// unlo|
|000051c0| 63 6b 20 74 68 65 20 57 | 45 20 72 65 63 6f 72 64 |ck the W|E record|
|000051d0| 0d 09 5f 57 45 53 65 74 | 48 61 6e 64 6c 65 4c 6f |.._WESet|HandleLo|
|000051e0| 63 6b 28 28 48 61 6e 64 | 6c 65 29 20 68 57 45 2c |ck((Hand|le) hWE,|
|000051f0| 20 73 61 76 65 57 45 4c | 6f 63 6b 29 3b 0d 0d 09 | saveWEL|ock);...|
|00005200| 2f 2f 20 72 65 74 75 72 | 6e 20 72 65 73 75 6c 74 |// retur|n result|
|00005210| 20 63 6f 64 65 0d 09 72 | 65 74 75 72 6e 20 65 72 | code..r|eturn er|
|00005220| 72 3b 0d 7d 0d 0d 23 65 | 6e 64 69 66 09 2f 2f 20 |r;.}..#e|ndif.// |
|00005230| 57 41 53 54 45 5f 4f 42 | 4a 45 43 54 53 0d 0d 70 |WASTE_OB|JECTS..p|
|00005240| 61 73 63 61 6c 20 76 6f | 69 64 20 5f 57 45 42 75 |ascal vo|id _WEBu|
|00005250| 6d 70 52 75 6e 53 74 61 | 72 74 28 53 49 6e 74 33 |mpRunSta|rt(SInt3|
|00005260| 32 20 72 75 6e 49 6e 64 | 65 78 2c 20 53 49 6e 74 |2 runInd|ex, SInt|
|00005270| 33 32 20 64 65 6c 74 61 | 52 75 6e 53 74 61 72 74 |32 delta|RunStart|
|00005280| 2c 20 57 45 50 74 72 20 | 70 57 45 29 0d 7b 0d 09 |, WEPtr |pWE).{..|
|00005290| 2f 2f 20 61 64 64 20 64 | 65 6c 74 61 4c 69 6e 65 |// add d|eltaLine|
|000052a0| 53 74 61 72 74 20 74 6f | 20 74 68 65 20 6c 69 6e |Start to| the lin|
|000052b0| 65 53 74 61 72 74 20 66 | 69 65 6c 64 20 6f 66 20 |eStart f|ield of |
|000052c0| 61 6c 6c 20 6c 69 6e 65 | 20 72 65 63 6f 72 64 73 |all line| records|
|000052d0| 0d 09 2f 2f 20 73 74 61 | 72 74 69 6e 67 20 66 72 |..// sta|rting fr|
|000052e0| 6f 6d 20 6c 69 6e 65 49 | 6e 64 65 78 0d 0d 09 57 |om lineI|ndex...W|
|000052f0| 45 52 75 6e 41 72 72 61 | 79 45 6e 74 72 79 20 2a |ERunArra|yEntry *|
|00005300| 70 52 75 6e 20 3d 20 2a | 70 57 45 2d 3e 68 52 75 |pRun = *|pWE->hRu|
|00005310| 6e 73 20 2b 20 72 75 6e | 49 6e 64 65 78 3b 0d 09 |ns + run|Index;..|
|00005320| 53 49 6e 74 33 32 20 6e | 52 75 6e 73 20 3d 20 70 |SInt32 n|Runs = p|
|00005330| 57 45 2d 3e 6e 52 75 6e | 73 3b 0d 0d 09 2f 2f 20 |WE->nRun|s;...// |
|00005340| 6c 6f 6f 70 20 74 68 72 | 6f 75 67 68 20 74 68 65 |loop thr|ough the|
|00005350| 20 73 74 79 6c 65 20 72 | 75 6e 20 61 72 72 61 79 | style r|un array|
|00005360| 20 61 64 6a 75 73 74 69 | 6e 67 20 74 68 65 20 72 | adjusti|ng the r|
|00005370| 75 6e 53 74 61 72 74 20 | 66 69 65 6c 64 73 0d 09 |unStart |fields..|
|00005380| 66 6f 72 20 28 20 3b 20 | 72 75 6e 49 6e 64 65 78 |for ( ; |runIndex|
|00005390| 20 3c 3d 20 6e 52 75 6e | 73 3b 20 72 75 6e 49 6e | <= nRun|s; runIn|
|000053a0| 64 65 78 2b 2b 20 29 0d | 09 7b 0d 09 09 70 52 75 |dex++ ).|.{...pRu|
|000053b0| 6e 2d 3e 72 75 6e 53 74 | 61 72 74 20 2b 3d 20 64 |n->runSt|art += d|
|000053c0| 65 6c 74 61 52 75 6e 53 | 74 61 72 74 3b 0d 09 09 |eltaRunS|tart;...|
|000053d0| 70 52 75 6e 2b 2b 3b 0d | 09 7d 0d 7d 0d 0d 70 61 |pRun++;.|.}.}..pa|
|000053e0| 73 63 61 6c 20 76 6f 69 | 64 20 5f 57 45 52 65 6d |scal voi|d _WERem|
|000053f0| 6f 76 65 52 75 6e 52 61 | 6e 67 65 28 53 49 6e 74 |oveRunRa|nge(SInt|
|00005400| 33 32 20 72 61 6e 67 65 | 53 74 61 72 74 2c 20 53 |32 range|Start, S|
|00005410| 49 6e 74 33 32 20 72 61 | 6e 67 65 45 6e 64 2c 20 |Int32 ra|ngeEnd, |
|00005420| 57 45 48 61 6e 64 6c 65 | 20 68 57 45 29 0d 7b 0d |WEHandle| hWE).{.|
|00005430| 09 2f 2f 20 74 68 65 20 | 72 61 6e 67 65 20 6f 66 |.// the |range of|
|00005440| 20 74 65 78 74 20 62 65 | 74 77 65 65 6e 20 72 61 | text be|tween ra|
|00005450| 6e 67 65 53 74 61 72 74 | 20 61 6e 64 20 72 61 6e |ngeStart| and ran|
|00005460| 67 65 45 6e 64 20 69 73 | 20 62 65 69 6e 67 20 64 |geEnd is| being d|
|00005470| 65 6c 65 74 65 64 0d 09 | 2f 2f 20 75 70 64 61 74 |eleted..|// updat|
|00005480| 65 20 74 68 65 20 73 74 | 79 6c 65 20 72 75 6e 20 |e the st|yle run |
|00005490| 61 72 72 61 79 20 28 61 | 6e 64 20 74 68 65 20 73 |array (a|nd the s|
|000054a0| 74 79 6c 65 20 74 61 62 | 6c 65 29 20 61 63 63 6f |tyle tab|le) acco|
|000054b0| 72 64 69 6e 67 6c 79 0d | 0d 09 57 45 50 74 72 20 |rdingly.|..WEPtr |
|000054c0| 70 57 45 20 3d 20 2a 68 | 57 45 3b 09 2f 2f 20 61 |pWE = *h|WE;.// a|
|000054d0| 73 73 75 6d 65 20 57 45 | 20 72 65 63 6f 72 64 20 |ssume WE| record |
|000054e0| 69 73 20 61 6c 72 65 61 | 64 79 20 6c 6f 63 6b 65 |is alrea|dy locke|
|000054f0| 64 0d 09 57 45 52 75 6e | 41 72 72 61 79 45 6e 74 |d..WERun|ArrayEnt|
|00005500| 72 79 20 2a 70 52 75 6e | 3b 0d 09 53 49 6e 74 33 |ry *pRun|;..SInt3|
|00005510| 32 20 73 74 61 72 74 52 | 75 6e 2c 20 65 6e 64 52 |2 startR|un, endR|
|00005520| 75 6e 3b 0d 0d 09 2f 2f | 20 66 69 6e 64 20 74 68 |un;...//| find th|
|00005530| 65 20 69 6e 64 65 78 20 | 74 6f 20 74 68 65 20 66 |e index |to the f|
|00005540| 69 72 73 74 20 61 6e 64 | 20 6c 61 73 74 20 73 74 |irst and| last st|
|00005550| 79 6c 65 20 72 75 6e 73 | 20 69 6e 20 74 68 65 20 |yle runs| in the |
|00005560| 73 70 65 63 69 66 69 65 | 64 20 72 61 6e 67 65 0d |specifie|d range.|
|00005570| 09 73 74 61 72 74 52 75 | 6e 20 3d 20 57 45 4f 66 |.startRu|n = WEOf|
|00005580| 66 73 65 74 54 6f 52 75 | 6e 28 72 61 6e 67 65 53 |fsetToRu|n(rangeS|
|00005590| 74 61 72 74 2c 20 68 57 | 45 29 3b 0d 09 65 6e 64 |tart, hW|E);..end|
|000055a0| 52 75 6e 20 3d 20 57 45 | 4f 66 66 73 65 74 54 6f |Run = WE|OffsetTo|
|000055b0| 52 75 6e 28 72 61 6e 67 | 65 45 6e 64 2c 20 68 57 |Run(rang|eEnd, hW|
|000055c0| 45 29 20 2d 20 31 3b 0d | 0d 09 2f 2f 20 72 65 6d |E) - 1;.|..// rem|
|000055d0| 6f 76 65 20 61 6c 6c 20 | 73 74 79 6c 65 20 72 75 |ove all |style ru|
|000055e0| 6e 73 20 62 65 74 77 65 | 65 6e 20 73 74 61 72 74 |ns betwe|en start|
|000055f0| 52 75 6e 20 61 6e 64 20 | 65 6e 64 52 75 6e 0d 09 |Run and |endRun..|
|00005600| 66 6f 72 20 28 20 3b 20 | 65 6e 64 52 75 6e 20 3e |for ( ; |endRun >|
|00005610| 20 73 74 61 72 74 52 75 | 6e 3b 20 65 6e 64 52 75 | startRu|n; endRu|
|00005620| 6e 2d 2d 20 29 0d 09 7b | 0d 09 09 5f 57 45 52 65 |n-- )..{|..._WERe|
|00005630| 6d 6f 76 65 52 75 6e 28 | 65 6e 64 52 75 6e 2c 20 |moveRun(|endRun, |
|00005640| 70 57 45 29 3b 0d 09 7d | 0d 0d 09 2f 2f 20 6d 6f |pWE);..}|...// mo|
|00005650| 76 65 20 62 61 63 6b 20 | 61 6c 6c 20 73 75 62 73 |ve back |all subs|
|00005660| 65 71 75 65 6e 74 20 73 | 74 79 6c 65 20 72 75 6e |equent s|tyle run|
|00005670| 73 0d 09 5f 57 45 42 75 | 6d 70 52 75 6e 53 74 61 |s.._WEBu|mpRunSta|
|00005680| 72 74 28 73 74 61 72 74 | 52 75 6e 20 2b 20 31 2c |rt(start|Run + 1,|
|00005690| 20 72 61 6e 67 65 53 74 | 61 72 74 20 2d 20 72 61 | rangeSt|art - ra|
|000056a0| 6e 67 65 45 6e 64 2c 20 | 70 57 45 29 3b 0d 0d 09 |ngeEnd, |pWE);...|
|000056b0| 69 66 20 28 28 65 6e 64 | 52 75 6e 20 3d 3d 20 73 |if ((end|Run == s|
|000056c0| 74 61 72 74 52 75 6e 29 | 20 26 26 20 28 65 6e 64 |tartRun)| && (end|
|000056d0| 52 75 6e 20 3c 20 70 57 | 45 2d 3e 6e 52 75 6e 73 |Run < pW|E->nRuns|
|000056e0| 20 2d 20 31 29 29 0d 09 | 7b 0d 09 09 70 52 75 6e | - 1))..|{...pRun|
|000056f0| 20 3d 20 2a 70 57 45 2d | 3e 68 52 75 6e 73 20 2b | = *pWE-|>hRuns +|
|00005700| 20 65 6e 64 52 75 6e 3b | 0d 09 09 70 52 75 6e 5b | endRun;|...pRun[|
|00005710| 31 5d 2e 72 75 6e 53 74 | 61 72 74 20 3d 20 72 61 |1].runSt|art = ra|
|00005720| 6e 67 65 53 74 61 72 74 | 3b 0d 09 7d 0d 0d 09 2f |ngeStart|;..}.../|
|00005730| 2f 20 72 65 6d 6f 76 65 | 20 74 68 65 20 66 69 72 |/ remove| the fir|
|00005740| 73 74 20 73 74 79 6c 65 | 20 72 75 6e 20 69 66 20 |st style| run if |
|00005750| 69 73 20 68 61 73 20 62 | 65 63 6f 6d 65 20 7a 65 |is has b|ecome ze|
|00005760| 72 6f 20 6c 65 6e 67 74 | 68 0d 09 70 52 75 6e 20 |ro lengt|h..pRun |
|00005770| 3d 20 2a 70 57 45 2d 3e | 68 52 75 6e 73 20 2b 20 |= *pWE->|hRuns + |
|00005780| 73 74 61 72 74 52 75 6e | 3b 0d 09 69 66 20 28 70 |startRun|;..if (p|
|00005790| 52 75 6e 5b 30 5d 2e 72 | 75 6e 53 74 61 72 74 20 |Run[0].r|unStart |
|000057a0| 3d 3d 20 70 52 75 6e 5b | 31 5d 2e 72 75 6e 53 74 |== pRun[|1].runSt|
|000057b0| 61 72 74 29 0d 09 7b 0d | 09 09 5f 57 45 52 65 6d |art)..{.|.._WERem|
|000057c0| 6f 76 65 52 75 6e 28 73 | 74 61 72 74 52 75 6e 2c |oveRun(s|tartRun,|
|000057d0| 20 70 57 45 29 3b 0d 09 | 09 73 74 61 72 74 52 75 | pWE);..|.startRu|
|000057e0| 6e 2d 2d 3b 0d 09 7d 0d | 0d 09 2f 2f 20 6d 65 72 |n--;..}.|..// mer|
|000057f0| 67 65 20 74 68 65 20 66 | 69 72 73 74 20 61 6e 64 |ge the f|irst and|
|00005800| 20 6c 61 73 74 20 72 75 | 6e 73 20 69 66 20 74 68 | last ru|ns if th|
|00005810| 65 79 20 68 61 76 65 20 | 74 68 65 20 73 61 6d 65 |ey have |the same|
|00005820| 20 73 74 79 6c 65 20 69 | 6e 64 65 78 0d 09 69 66 | style i|ndex..if|
|00005830| 20 28 73 74 61 72 74 52 | 75 6e 20 3e 3d 20 30 29 | (startR|un >= 0)|
|00005840| 0d 09 7b 0d 09 09 70 52 | 75 6e 20 3d 20 2a 70 57 |..{...pR|un = *pW|
|00005850| 45 2d 3e 68 52 75 6e 73 | 20 2b 20 73 74 61 72 74 |E->hRuns| + start|
|00005860| 52 75 6e 3b 0d 09 09 69 | 66 20 28 70 52 75 6e 5b |Run;...i|f (pRun[|
|00005870| 30 5d 2e 73 74 79 6c 65 | 49 6e 64 65 78 20 3d 3d |0].style|Index ==|
|00005880| 20 70 52 75 6e 5b 31 5d | 2e 73 74 79 6c 65 49 6e | pRun[1]|.styleIn|
|00005890| 64 65 78 29 0d 09 09 7b | 0d 09 09 09 5f 57 45 52 |dex)...{|...._WER|
|000058a0| 65 6d 6f 76 65 52 75 6e | 28 73 74 61 72 74 52 75 |emoveRun|(startRu|
|000058b0| 6e 20 2b 20 31 2c 20 70 | 57 45 29 3b 0d 09 09 7d |n + 1, p|WE);...}|
|000058c0| 0d 09 7d 0d 7d 0d 0d 70 | 61 73 63 61 6c 20 76 6f |..}.}..p|ascal vo|
|000058d0| 69 64 20 5f 57 45 42 75 | 6d 70 4c 69 6e 65 53 74 |id _WEBu|mpLineSt|
|000058e0| 61 72 74 28 53 49 6e 74 | 33 32 20 6c 69 6e 65 49 |art(SInt|32 lineI|
|000058f0| 6e 64 65 78 2c 20 53 49 | 6e 74 33 32 20 64 65 6c |ndex, SI|nt32 del|
|00005900| 74 61 4c 69 6e 65 53 74 | 61 72 74 2c 20 57 45 50 |taLineSt|art, WEP|
|00005910| 74 72 20 70 57 45 29 0d | 7b 0d 09 2f 2f 20 61 64 |tr pWE).|{..// ad|
|00005920| 64 20 64 65 6c 74 61 4c | 69 6e 65 53 74 61 72 74 |d deltaL|ineStart|
|00005930| 20 74 6f 20 74 68 65 20 | 6c 69 6e 65 53 74 61 72 | to the |lineStar|
|00005940| 74 20 66 69 65 6c 64 20 | 6f 66 20 61 6c 6c 20 6c |t field |of all l|
|00005950| 69 6e 65 20 72 65 63 6f | 72 64 73 0d 09 2f 2f 20 |ine reco|rds..// |
|00005960| 73 74 61 72 74 69 6e 67 | 20 66 72 6f 6d 20 6c 69 |starting| from li|
|00005970| 6e 65 49 6e 64 65 78 0d | 0d 09 57 45 4c 69 6e 65 |neIndex.|..WELine|
|00005980| 52 65 63 20 2a 70 4c 69 | 6e 65 20 3d 20 2a 70 57 |Rec *pLi|ne = *pW|
|00005990| 45 2d 3e 68 4c 69 6e 65 | 73 20 2b 20 6c 69 6e 65 |E->hLine|s + line|
|000059a0| 49 6e 64 65 78 3b 0d 09 | 53 49 6e 74 33 32 20 6e |Index;..|SInt32 n|
|000059b0| 4c 69 6e 65 73 20 3d 20 | 70 57 45 2d 3e 6e 4c 69 |Lines = |pWE->nLi|
|000059c0| 6e 65 73 3b 0d 0d 09 2f | 2f 20 6c 6f 6f 70 20 74 |nes;.../|/ loop t|
|000059d0| 68 72 6f 75 67 68 20 74 | 68 65 20 6c 69 6e 65 20 |hrough t|he line |
|000059e0| 61 72 72 61 79 20 61 64 | 6a 75 73 74 69 6e 67 20 |array ad|justing |
|000059f0| 74 68 65 20 6c 69 6e 65 | 53 74 61 72 74 20 66 69 |the line|Start fi|
|00005a00| 65 6c 64 73 0d 09 66 6f | 72 20 28 20 3b 20 6c 69 |elds..fo|r ( ; li|
|00005a10| 6e 65 49 6e 64 65 78 20 | 3c 3d 20 6e 4c 69 6e 65 |neIndex |<= nLine|
|00005a20| 73 3b 20 6c 69 6e 65 49 | 6e 64 65 78 2b 2b 20 29 |s; lineI|ndex++ )|
|00005a30| 0d 09 7b 0d 09 09 70 4c | 69 6e 65 2d 3e 6c 69 6e |..{...pL|ine->lin|
|00005a40| 65 53 74 61 72 74 20 2b | 3d 20 64 65 6c 74 61 4c |eStart +|= deltaL|
|00005a50| 69 6e 65 53 74 61 72 74 | 3b 0d 09 09 70 4c 69 6e |ineStart|;...pLin|
|00005a60| 65 2b 2b 3b 0d 09 7d 0d | 7d 0d 0d 70 61 73 63 61 |e++;..}.|}..pasca|
|00005a70| 6c 20 76 6f 69 64 20 5f | 57 45 52 65 6d 6f 76 65 |l void _|WERemove|
|00005a80| 4c 69 6e 65 52 61 6e 67 | 65 28 53 49 6e 74 33 32 |LineRang|e(SInt32|
|00005a90| 20 72 61 6e 67 65 53 74 | 61 72 74 2c 20 53 49 6e | rangeSt|art, SIn|
|00005aa0| 74 33 32 20 72 61 6e 67 | 65 45 6e 64 2c 20 57 45 |t32 rang|eEnd, WE|
|00005ab0| 48 61 6e 64 6c 65 20 68 | 57 45 29 0d 7b 0d 09 2f |Handle h|WE).{../|
|00005ac0| 2f 20 74 68 65 20 72 61 | 6e 67 65 20 6f 66 20 74 |/ the ra|nge of t|
|00005ad0| 65 78 74 20 62 65 74 77 | 65 65 6e 20 72 61 6e 67 |ext betw|een rang|
|00005ae0| 65 53 74 61 72 74 20 61 | 6e 64 20 72 61 6e 67 65 |eStart a|nd range|
|00005af0| 45 6e 64 20 69 73 20 62 | 65 69 6e 67 20 64 65 6c |End is b|eing del|
|00005b00| 65 74 65 64 0d 09 2f 2f | 20 75 70 64 61 74 65 20 |eted..//| update |
|00005b10| 74 68 65 20 6c 69 6e 65 | 20 61 72 72 61 79 20 61 |the line| array a|
|00005b20| 63 63 6f 72 64 69 6e 67 | 6c 79 0d 0d 09 57 45 50 |ccording|ly...WEP|
|00005b30| 74 72 20 70 57 45 20 3d | 20 2a 68 57 45 3b 09 2f |tr pWE =| *hWE;./|
|00005b40| 2f 20 61 73 73 75 6d 65 | 20 57 45 20 72 65 63 6f |/ assume| WE reco|
|00005b50| 72 64 20 69 73 20 61 6c | 72 65 61 64 79 20 6c 6f |rd is al|ready lo|
|00005b60| 63 6b 65 64 0d 09 53 49 | 6e 74 33 32 20 73 74 61 |cked..SI|nt32 sta|
|00005b70| 72 74 4c 69 6e 65 2c 20 | 6e 4c 69 6e 65 73 3b 0d |rtLine, |nLines;.|
|00005b80| 0d 09 2f 2f 20 72 65 6d | 6f 76 65 20 61 6c 6c 20 |..// rem|ove all |
|00005b90| 6c 69 6e 65 20 72 65 63 | 6f 72 64 73 20 62 65 74 |line rec|ords bet|
|00005ba0| 77 65 65 6e 20 72 61 6e | 67 65 53 74 61 72 74 20 |ween ran|geStart |
|00005bb0| 61 6e 64 20 72 61 6e 67 | 65 45 6e 64 0d 09 73 74 |and rang|eEnd..st|
|00005bc0| 61 72 74 4c 69 6e 65 20 | 3d 20 57 45 4f 66 66 73 |artLine |= WEOffs|
|00005bd0| 65 74 54 6f 4c 69 6e 65 | 28 72 61 6e 67 65 53 74 |etToLine|(rangeSt|
|00005be0| 61 72 74 2c 20 68 57 45 | 29 20 2b 20 31 3b 0d 09 |art, hWE|) + 1;..|
|00005bf0| 6e 4c 69 6e 65 73 20 3d | 20 57 45 4f 66 66 73 65 |nLines =| WEOffse|
|00005c00| 74 54 6f 4c 69 6e 65 28 | 72 61 6e 67 65 45 6e 64 |tToLine(|rangeEnd|
|00005c10| 2c 20 68 57 45 29 20 2d | 20 73 74 61 72 74 4c 69 |, hWE) -| startLi|
|00005c20| 6e 65 20 2b 20 31 3b 0d | 0d 09 5f 57 45 53 70 6c |ne + 1;.|.._WESpl|
|00005c30| 69 63 65 28 28 48 61 6e | 64 6c 65 29 20 70 57 45 |ice((Han|dle) pWE|
|00005c40| 2d 3e 68 4c 69 6e 65 73 | 2c 20 6e 69 6c 2c 20 2d |->hLines|, nil, -|
|00005c50| 20 28 6e 4c 69 6e 65 73 | 20 2a 20 73 69 7a 65 6f | (nLines| * sizeo|
|00005c60| 66 28 57 45 4c 69 6e 65 | 52 65 63 29 29 2c 20 73 |f(WELine|Rec)), s|
|00005c70| 74 61 72 74 4c 69 6e 65 | 20 2a 20 73 69 7a 65 6f |tartLine| * sizeo|
|00005c80| 66 28 57 45 4c 69 6e 65 | 52 65 63 29 29 3b 0d 09 |f(WELine|Rec));..|
|00005c90| 70 57 45 2d 3e 6e 4c 69 | 6e 65 73 20 2d 3d 20 6e |pWE->nLi|nes -= n|
|00005ca0| 4c 69 6e 65 73 3b 0d 0d | 09 2f 2f 20 75 70 64 61 |Lines;..|.// upda|
|00005cb0| 74 65 20 74 68 65 20 6c | 69 6e 65 53 74 61 72 74 |te the l|ineStart|
|00005cc0| 20 66 69 65 6c 64 20 6f | 66 20 61 6c 6c 20 74 68 | field o|f all th|
|00005cd0| 65 20 6c 69 6e 65 20 72 | 65 63 6f 72 64 73 20 74 |e line r|ecords t|
|00005ce0| 68 61 74 20 66 6f 6c 6c | 6f 77 0d 09 5f 57 45 42 |hat foll|ow.._WEB|
|00005cf0| 75 6d 70 4c 69 6e 65 53 | 74 61 72 74 28 73 74 61 |umpLineS|tart(sta|
|00005d00| 72 74 4c 69 6e 65 2c 20 | 72 61 6e 67 65 53 74 61 |rtLine, |rangeSta|
|00005d10| 72 74 20 2d 20 72 61 6e | 67 65 45 6e 64 2c 20 70 |rt - ran|geEnd, p|
|00005d20| 57 45 29 3b 0d 7d 0d 0d | 70 61 73 63 61 6c 20 4f |WE);.}..|pascal O|
|00005d30| 53 45 72 72 20 5f 57 45 | 44 65 6c 65 74 65 52 61 |SErr _WE|DeleteRa|
|00005d40| 6e 67 65 28 53 49 6e 74 | 33 32 20 72 61 6e 67 65 |nge(SInt|32 range|
|00005d50| 53 74 61 72 74 2c 20 53 | 49 6e 74 33 32 20 72 61 |Start, S|Int32 ra|
|00005d60| 6e 67 65 45 6e 64 2c 20 | 57 45 48 61 6e 64 6c 65 |ngeEnd, |WEHandle|
|00005d70| 20 68 57 45 29 0d 7b 0d | 09 2f 2f 20 75 73 65 64 | hWE).{.|.// used|
|00005d80| 20 69 6e 74 65 72 6e 61 | 6c 6c 79 20 74 6f 20 64 | interna|lly to d|
|00005d90| 65 6c 65 74 65 20 61 20 | 74 65 78 74 20 72 61 6e |elete a |text ran|
|00005da0| 67 65 0d 09 57 45 50 74 | 72 20 70 57 45 20 3d 20 |ge..WEPt|r pWE = |
|00005db0| 2a 68 57 45 3b 09 2f 2f | 20 61 73 73 75 6d 65 20 |*hWE;.//| assume |
|00005dc0| 57 45 20 72 65 63 6f 72 | 64 20 69 73 20 61 6c 72 |WE recor|d is alr|
|00005dd0| 65 61 64 79 20 6c 6f 63 | 6b 65 64 0d 09 57 45 52 |eady loc|ked..WER|
|00005de0| 75 6e 49 6e 66 6f 50 72 | 69 76 20 72 75 6e 49 6e |unInfoPr|iv runIn|
|00005df0| 66 6f 3b 0d 09 53 49 6e | 74 33 32 20 64 65 6c 74 |fo;..SIn|t32 delt|
|00005e00| 61 3b 0d 09 4f 53 45 72 | 72 20 65 72 72 20 3d 20 |a;..OSEr|r err = |
|00005e10| 6e 6f 45 72 72 3b 0d 0d | 09 69 66 20 28 72 61 6e |noErr;..|.if (ran|
|00005e20| 67 65 45 6e 64 20 3e 20 | 70 57 45 2d 3e 74 65 78 |geEnd > |pWE->tex|
|00005e30| 74 4c 65 6e 67 74 68 29 | 0d 09 7b 0d 09 09 72 61 |tLength)|..{...ra|
|00005e40| 6e 67 65 45 6e 64 20 3d | 20 70 57 45 2d 3e 74 65 |ngeEnd =| pWE->te|
|00005e50| 78 74 4c 65 6e 67 74 68 | 3b 0d 09 7d 0d 0d 09 2f |xtLength|;..}.../|
|00005e60| 2f 20 64 6f 20 6e 6f 74 | 68 69 6e 67 20 69 66 20 |/ do not|hing if |
|00005e70| 74 68 65 20 73 70 65 63 | 69 66 69 65 64 20 72 61 |the spec|ified ra|
|00005e80| 6e 67 65 20 69 73 20 65 | 6d 70 74 79 0d 09 69 66 |nge is e|mpty..if|
|00005e90| 20 28 28 64 65 6c 74 61 | 20 3d 20 28 72 61 6e 67 | ((delta| = (rang|
|00005ea0| 65 53 74 61 72 74 20 2d | 20 72 61 6e 67 65 45 6e |eStart -| rangeEn|
|00005eb0| 64 29 29 20 3d 3d 20 30 | 29 0d 09 7b 0d 09 09 67 |d)) == 0|)..{...g|
|00005ec0| 6f 74 6f 20 63 6c 65 61 | 6e 75 70 3b 0d 09 7d 0d |oto clea|nup;..}.|
|00005ed0| 0d 09 2f 2f 20 73 61 76 | 65 20 74 68 65 20 66 69 |..// sav|e the fi|
|00005ee0| 72 73 74 20 73 74 79 6c | 65 20 69 6e 20 74 68 65 |rst styl|e in the|
|00005ef0| 20 73 70 65 63 69 66 69 | 65 64 20 72 61 6e 67 65 | specifi|ed range|
|00005f00| 20 69 6e 20 6e 75 6c 6c | 53 74 79 6c 65 0d 09 57 | in null|Style..W|
|00005f10| 45 47 65 74 52 75 6e 49 | 6e 66 6f 28 72 61 6e 67 |EGetRunI|nfo(rang|
|00005f20| 65 53 74 61 72 74 2c 20 | 28 57 45 52 75 6e 49 6e |eStart, |(WERunIn|
|00005f30| 66 6f 20 2a 29 26 72 75 | 6e 49 6e 66 6f 2c 20 68 |fo *)&ru|nInfo, h|
|00005f40| 57 45 29 3b 0d 09 70 57 | 45 2d 3e 6e 75 6c 6c 53 |WE);..pW|E->nullS|
|00005f50| 74 79 6c 65 20 3d 20 72 | 75 6e 49 6e 66 6f 2e 72 |tyle = r|unInfo.r|
|00005f60| 75 6e 41 74 74 72 73 3b | 0d 09 42 53 45 54 28 70 |unAttrs;|..BSET(p|
|00005f70| 57 45 2d 3e 66 6c 61 67 | 73 2c 20 77 65 46 55 73 |WE->flag|s, weFUs|
|00005f80| 65 4e 75 6c 6c 53 74 79 | 6c 65 29 3b 0d 0d 23 69 |eNullSty|le);..#i|
|00005f90| 66 20 57 41 53 54 45 5f | 4f 42 4a 45 43 54 53 0d |f WASTE_|OBJECTS.|
|00005fa0| 09 2f 2f 20 73 70 65 63 | 69 61 6c 20 63 61 73 65 |.// spec|ial case|
|00005fb0| 3a 20 69 66 20 77 65 27 | 72 65 20 64 65 6c 65 74 |: if we'|re delet|
|00005fc0| 69 6e 67 20 75 70 20 74 | 6f 20 74 68 65 20 65 6e |ing up t|o the en|
|00005fd0| 64 20 6f 66 20 74 68 65 | 20 74 65 78 74 2c 20 73 |d of the| text, s|
|00005fe0| 65 65 20 77 68 65 74 68 | 65 72 0d 09 2f 2f 20 74 |ee wheth|er..// t|
|00005ff0| 68 65 72 65 27 73 20 61 | 6e 20 65 6d 62 65 64 64 |here's a|n embedd|
|00006000| 65 64 20 6f 62 6a 65 63 | 74 20 61 74 20 74 68 65 |ed objec|t at the|
|00006010| 20 76 65 72 79 20 65 6e | 64 20 61 6e 64 20 72 65 | very en|d and re|
|00006020| 6d 6f 76 65 20 69 74 0d | 09 69 66 20 28 72 61 6e |move it.|.if (ran|
|00006030| 67 65 45 6e 64 20 3d 3d | 20 70 57 45 2d 3e 74 65 |geEnd ==| pWE->te|
|00006040| 78 74 4c 65 6e 67 74 68 | 29 0d 09 7b 0d 09 09 57 |xtLength|)..{...W|
|00006050| 45 47 65 74 52 75 6e 49 | 6e 66 6f 28 72 61 6e 67 |EGetRunI|nfo(rang|
|00006060| 65 45 6e 64 20 2d 20 31 | 2c 20 28 57 45 52 75 6e |eEnd - 1|, (WERun|
|00006070| 49 6e 66 6f 20 2a 29 26 | 72 75 6e 49 6e 66 6f 2c |Info *)&|runInfo,|
|00006080| 20 68 57 45 29 3b 0d 09 | 09 69 66 20 28 72 75 6e | hWE);..|.if (run|
|00006090| 49 6e 66 6f 2e 72 75 6e | 41 74 74 72 73 2e 72 75 |Info.run|Attrs.ru|
|000060a0| 6e 53 74 79 6c 65 2e 74 | 73 4f 62 6a 65 63 74 20 |nStyle.t|sObject |
|000060b0| 21 3d 20 6e 69 6c 29 0d | 09 09 7b 0d 09 09 09 72 |!= nil).|..{....r|
|000060c0| 75 6e 49 6e 66 6f 2e 72 | 75 6e 41 74 74 72 73 2e |unInfo.r|unAttrs.|
|000060d0| 72 75 6e 53 74 79 6c 65 | 2e 74 73 4f 62 6a 65 63 |runStyle|.tsObjec|
|000060e0| 74 20 3d 20 6e 69 6c 3b | 0d 09 09 09 69 66 20 28 |t = nil;|....if (|
|000060f0| 28 65 72 72 20 3d 20 5f | 57 45 53 65 74 53 74 79 |(err = _|WESetSty|
|00006100| 6c 65 52 61 6e 67 65 28 | 72 61 6e 67 65 45 6e 64 |leRange(|rangeEnd|
|00006110| 20 2d 20 31 2c 20 72 61 | 6e 67 65 45 6e 64 2c 20 | - 1, ra|ngeEnd, |
|00006120| 77 65 44 6f 4f 62 6a 65 | 63 74 2c 20 26 72 75 6e |weDoObje|ct, &run|
|00006130| 49 6e 66 6f 2e 72 75 6e | 41 74 74 72 73 2e 72 75 |Info.run|Attrs.ru|
|00006140| 6e 53 74 79 6c 65 2c 20 | 68 57 45 29 29 20 21 3d |nStyle, |hWE)) !=|
|00006150| 20 6e 6f 45 72 72 29 0d | 09 09 09 7b 0d 09 09 09 | noErr).|...{....|
|00006160| 09 67 6f 74 6f 20 63 6c | 65 61 6e 75 70 3b 0d 09 |.goto cl|eanup;..|
|00006170| 09 09 7d 0d 09 09 7d 0d | 09 7d 0d 23 65 6e 64 69 |..}...}.|.}.#endi|
|00006180| 66 0d 0d 09 2f 2f 20 72 | 65 6d 6f 76 65 20 61 6c |f...// r|emove al|
|00006190| 6c 20 6c 69 6e 65 20 72 | 65 63 6f 72 64 73 20 62 |l line r|ecords b|
|000061a0| 65 74 77 65 65 6e 20 72 | 61 6e 67 65 53 74 61 72 |etween r|angeStar|
|000061b0| 74 20 61 6e 64 20 72 61 | 6e 67 65 45 6e 64 0d 09 |t and ra|ngeEnd..|
|000061c0| 5f 57 45 52 65 6d 6f 76 | 65 4c 69 6e 65 52 61 6e |_WERemov|eLineRan|
|000061d0| 67 65 28 72 61 6e 67 65 | 53 74 61 72 74 2c 20 72 |ge(range|Start, r|
|000061e0| 61 6e 67 65 45 6e 64 2c | 20 68 57 45 29 3b 0d 0d |angeEnd,| hWE);..|
|000061f0| 09 2f 2f 20 72 65 6d 6f | 76 65 20 61 6c 6c 20 73 |.// remo|ve all s|
|00006200| 74 79 6c 65 20 72 75 6e | 73 20 62 65 74 77 65 65 |tyle run|s betwee|
|00006210| 6e 20 72 61 6e 67 65 53 | 74 61 72 74 20 61 6e 64 |n rangeS|tart and|
|00006220| 20 72 61 6e 67 65 45 6e | 64 0d 09 5f 57 45 52 65 | rangeEn|d.._WERe|
|00006230| 6d 6f 76 65 52 75 6e 52 | 61 6e 67 65 28 72 61 6e |moveRunR|ange(ran|
|00006240| 67 65 53 74 61 72 74 2c | 20 72 61 6e 67 65 45 6e |geStart,| rangeEn|
|00006250| 64 2c 20 68 57 45 29 3b | 0d 0d 09 2f 2f 20 72 65 |d, hWE);|...// re|
|00006260| 6d 6f 76 65 20 74 68 65 | 20 74 65 78 74 0d 09 69 |move the| text..i|
|00006270| 66 20 28 28 65 72 72 20 | 3d 20 5f 57 45 53 70 6c |f ((err |= _WESpl|
|00006280| 69 63 65 28 70 57 45 2d | 3e 68 54 65 78 74 2c 20 |ice(pWE-|>hText, |
|00006290| 6e 69 6c 2c 20 64 65 6c | 74 61 2c 20 72 61 6e 67 |nil, del|ta, rang|
|000062a0| 65 53 74 61 72 74 29 29 | 20 21 3d 20 6e 6f 45 72 |eStart))| != noEr|
|000062b0| 72 29 0d 09 7b 0d 09 09 | 67 6f 74 6f 20 63 6c 65 |r)..{...|goto cle|
|000062c0| 61 6e 75 70 3b 0d 09 7d | 0d 0d 09 2f 2f 20 75 70 |anup;..}|...// up|
|000062d0| 64 61 74 65 20 74 65 78 | 74 4c 65 6e 67 74 68 20 |date tex|tLength |
|000062e0| 66 69 65 6c 64 0d 09 70 | 57 45 2d 3e 74 65 78 74 |field..p|WE->text|
|000062f0| 4c 65 6e 67 74 68 20 2b | 3d 20 64 65 6c 74 61 3b |Length +|= delta;|
|00006300| 0d 0d 09 2f 2f 20 77 65 | 20 6d 6f 64 69 66 69 65 |...// we| modifie|
|00006310| 64 20 74 68 65 20 74 65 | 78 74 2c 20 73 6f 20 74 |d the te|xt, so t|
|00006320| 68 65 20 61 6e 63 68 6f | 72 20 72 61 6e 67 65 20 |he ancho|r range |
|00006330| 28 69 66 20 61 6e 79 29 | 20 69 73 20 6e 6f 20 6c |(if any)| is no l|
|00006340| 6f 6e 67 65 72 20 76 61 | 6c 69 64 0d 09 70 57 45 |onger va|lid..pWE|
|00006350| 2d 3e 63 6c 69 63 6b 43 | 6f 75 6e 74 20 3d 20 30 |->clickC|ount = 0|
|00006360| 3b 0d 0d 09 2f 2f 20 63 | 61 6c 6c 20 74 68 65 20 |;...// c|all the |
|00006370| 66 6c 75 78 20 63 61 6c | 6c 62 61 63 6b 2c 20 69 |flux cal|lback, i|
|00006380| 66 20 61 6e 79 0d 09 69 | 66 20 28 70 57 45 2d 3e |f any..i|f (pWE->|
|00006390| 66 6c 75 78 50 72 6f 63 | 20 21 3d 20 6e 69 6c 29 |fluxProc| != nil)|
|000063a0| 0d 09 7b 0d 09 09 43 61 | 6c 6c 57 45 46 6c 75 78 |..{...Ca|llWEFlux|
|000063b0| 50 72 6f 63 28 72 61 6e | 67 65 53 74 61 72 74 2c |Proc(ran|geStart,|
|000063c0| 20 64 65 6c 74 61 2c 20 | 68 57 45 2c 20 70 57 45 | delta, |hWE, pWE|
|000063d0| 2d 3e 66 6c 75 78 50 72 | 6f 63 29 3b 0d 09 7d 0d |->fluxPr|oc);..}.|
|000063e0| 0d 63 6c 65 61 6e 75 70 | 3a 0d 09 2f 2f 20 72 65 |.cleanup|:..// re|
|000063f0| 74 75 72 6e 20 72 65 73 | 75 6c 74 20 63 6f 64 65 |turn res|ult code|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.